已有183人关注
安装wxPython失败,求教!
发表在Python图书答疑 2021-12-29 悬赏:6 学分 《Python编程入门指南》第13章 常用的GUI框架 192页-192页
是否精华
版块置顶:

按照书上的安装方法出现如下提示,看不懂,求教!

C:\Users\Administrator.SC-201911110847>pip install -U wxPython

Collecting wxPython

  Using cached wxPython-4.1.1.tar.gz (66.0 MB)

  Preparing metadata (setup.py) ... done

Requirement already satisfied: pillow in d:\python\python310\lib\site-packages (from wxPython) (8.4.0)

Requirement already satisfied: six in d:\python\python310\lib\site-packages (from wxPython) (1.16.0)

Requirement already satisfied: numpy in d:\python\python310\lib\site-packages (from wxPython) (1.21.5)

Using legacy 'setup.py install' for wxPython, since package 'wheel' is not installed.

Installing collected packages: wxPython

    Running setup.py install for wxPython ... error

    ERROR: Command errored out with exit status 1:

     command: 'D:\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator.SC-201911110847\\AppData\\Local\\Temp\\pip-install-i7ngff8n\\wxpython_474be02b16ee4585b61b1a245da3b4b4\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator.SC-201911110847\\AppData\\Local\\Temp\\pip-install-i7ngff8n\\wxpython_474be02b16ee4585b61b1a245da3b4b4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Administrator.SC-201911110847\AppData\Local\Temp\pip-record-crcb_ul1\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Python\Python310\Include\wxPython'

         cwd: C:\Users\Administrator.SC-201911110847\AppData\Local\Temp\pip-install-i7ngff8n\wxpython_474be02b16ee4585b61b1a245da3b4b4\

    Complete output (49 lines):

    D:\Python\Python310\lib\site-packages\setuptools\dist.py:697: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead

      warnings.warn(

    running install

    running build

    C:\Users\Administrator.SC-201911110847\AppData\Local\Temp\pip-install-i7ngff8n\wxpython_474be02b16ee4585b61b1a245da3b4b4\build.py:41: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

      from distutils.dep_util import newer, newer_group

    Will build using: "D:\Python\Python310\python.exe"

    3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]

    Python's architecture is 64bit

    cfg.VERSION: 4.1.1


    Running command: build

    Running command: build_wx

    Command '"D:\Python\Python310\python.exe" -c "import setuptools, distutils.msvc9compiler as msvc; mc = msvc.MSVCCompiler(); mc.initialize(); print(mc.cc)"' failed with exit code 1.

    Traceback (most recent call last):


      File "<string>", line 1, in <module>


      File "D:\Python\Python310\lib\distutils\msvc9compiler.py", line 371, in initialize


        vc_env = query_vcvarsall(VERSION, plat_spec)


      File "D:\Python\Python310\lib\site-packages\setuptools\msvc.py", line 140, in msvc9_query_vcvarsall


        return EnvironmentInfo(arch, ver).return_env()


      File "D:\Python\Python310\lib\site-packages\setuptools\msvc.py", line 1740, in return_env


        [self.VCIncludes,


      File "D:\Python\Python310\lib\site-packages\setuptools\msvc.py", line 1282, in VCIncludes


        return [join(self.si.VCInstallDir, 'Include'),


      File "D:\Python\Python310\lib\site-packages\setuptools\msvc.py", line 840, in VCInstallDir


        raise distutils.errors.DistutilsPlatformError(msg)


    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.2 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

    Finished command: build_wx (0.492s)

    Finished command: build (0.492s)

    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\Python310\python.exe" -u build.py build

    Command '"D:\Python\Python310\python.exe" -u build.py build' failed with exit code 1.

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'D:\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator.SC-201911110847\\AppData\\Local\\Temp\\pip-install-i7ngff8n\\wxpython_474be02b16ee4585b61b1a245da3b4b4\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator.SC-201911110847\\AppData\\Local\\Temp\\pip-install-i7ngff8n\\wxpython_474be02b16ee4585b61b1a245da3b4b4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Administrator.SC-201911110847\AppData\Local\Temp\pip-record-crcb_ul1\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Python\Python310\Include\wxPython' Check the logs for full command output.

分享到:
精彩评论 3
无语_mrkj
学分:3155 LV11
2021-12-30
沙发

您换一下Python 3.9版本再安装这个模块试试。产生错误的原因可能是当前版本的wxPython还不支持Python 3.10。因为我在pypi网站上看,只支持到Python 3.9。

xghtz168
学分:162 LV4
2021-12-30
板凳

谢谢老师指教,安装python3.9.9后,就能安装wxpython了。按照视频教学的方法升级一下pip版本,就大功告成。


game99258
学分:2266 LV10
2022-07-31
地板

版本问题

首页上一页 1 下一页尾页 3 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照