亡者成败 2023-04-07 15:44 采纳率: 66.7%
浏览 38
已结题

python 用pip 安装wxpyhon出现问题

目前python版本为3.11.2 用pip后 Using cached wxPython-4.2.0.tar.gz (71.0 MB)

PS C:\Users\admin> pip install wxpython
Collecting wxpython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... done
Collecting pillow
  Downloading Pillow-9.5.0-cp311-cp311-win_amd64.whl (2.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 970.3 kB/s eta 0:00:00
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting numpy
  Downloading numpy-1.24.2-cp311-cp311-win_amd64.whl (14.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.8/14.8 MB 69.0 kB/s eta 0:00:00
Installing collected packages: six, pillow, numpy, wxpython
  DEPRECATION: wxpython is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not 
installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for wxpython ... error
  error: subprocess-exited-with-error

  × Running setup.py install for wxpython did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      D:\python\Lib\site-packages\setuptools\dist.py:788: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
        warnings.warn(
      D:\python\Lib\site-packages\setuptools\config\setupcfg.py:516: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      D:\python\Lib\site-packages\setuptools\dist.py:328: DistDeprecationWarning: use_2to3 is ignored.
        warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
      running install
      D:\python\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      WARNING: Building this way assumes that all generated files have been
      generated already.  If that is not the case then use build.py directly
      to generate the source and perform the build stage.  You can use
      --skip-build with the bdist_* or install commands to avoid this
      message and the wxWidgets and Phoenix build steps in the future.
     
      "D:\python\python.exe" -u build.py build
      Will build using: "D:\python\python.exe"
      3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
      Python's architecture is 64bit
      cfg.VERSION: 4.2.0
     
      Running command: build
      Running command: build_wx
      Command '"D:\python\python.exe" -c "import os, sys, setuptools.msvc; setuptools.msvc.isfile = lambda path: path is not None and os.path.isfile(path); ei = setuptools.msvc.EnvironmentInfo('x64', vc_min_ver=14.0); env = ei.return_env(); env['vc_ver'] = ei.vc_ver; env['vs_ver'] = ei.vs_ver; env['arch'] = ei.pi.arch; env['py_ver'] = sys.version_info[:2]; print(env)"' failed with exit code 1.
      Traceback (most recent call last):
     
        File "<string>", line 1, in <module>
     
        File "D:\python\Lib\site-packages\setuptools\msvc.py", line 1103, in __init__
     
          self.si = SystemInfo(self.ri, vc_ver)
     
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     
        File "D:\python\Lib\site-packages\setuptools\msvc.py", line 579, in __init__
      
          vc_ver or self._find_latest_available_vs_ver())
     
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     
        File "D:\python\Lib\site-packages\setuptools\msvc.py", line 593, in _find_latest_available_vs_ver
     
          raise distutils.errors.DistutilsPlatformError(
     
      distutils.errors.DistutilsPlatformError: No Microsoft Visual C++ version found
      Finished command: build_wx (0.703s)
      Finished command: build (0.703s)
      Command '"D:\python\python.exe" -u build.py build' failed with exit code 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> wxpython

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

这种情况应该怎么办?

  • 写回答

2条回答 默认 最新

  • 0xjade-Follow 2023-04-07 15:57
    关注

    根据错误信息,这个问题可能与 Microsoft Visual C++ 缺失有关。请按照以下步骤解决:

    安装 Microsoft Visual C++ Build Tools:

    访问 https://visualstudio.microsoft.com/visual-cpp-build-tools/ 并下载最新版本的 Microsoft Visual C++ Build Tools。

    安装 wxWidgets:

    下载 wxWidgets,选择您的平台(例如 Windows)和目标体系结构(例如 64 位):

    https://www.wxwidgets.org/downloads/

    重新运行 pip 安装命令:

    运行以下命令以安装 wxpython:

    pip install wxpython
    如果仍然无法安装,请尝试添加 --use-pep517 选项以启用新的构建系统:

    pip install wxpython --use-pep517

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月16日
  • 已采纳回答 4月8日
  • 创建了问题 4月7日

悬赏问题

  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题