亡者成败 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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵