wxpython Ubuntu 安装失败

你先看看自己的linux版本:

lsb_release -a

我是:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic

在这个网站
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/
找到你的linux发行版本:
在这里插入图片描述

找到你需要的版本:
在这里插入图片描述
把whl下载下来
然后手动安装:

pip install wxPython-4.1.1-cp39-cp39-linux_x86_64.whl

最后贴一下安装失败的报错log, 方便hxdm检索

root@X:~# pip install wxpython
Collecting wxpython
  Using cached https://mirrors.aliyun.com/pypi/packages/b0/4d/X/wxPython-4.1.1.tar.gz (66.0 MB)
Collecting pillow
  Downloading https://mirrors.aliyun.com/pypi/packages/c3/56/X/Pillow-9.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB)
     |████████████████████████████████| 4.3 MB 1.8 MB/s 
Requirement already satisfied: six in X/python3.7/site-packages (from wxpython) (1.16.0)
Requirement already satisfied: numpy in X/lib/python3.7/site-packages (from wxpython) (1.16.6)
Building wheels for collected packages: wxpython
  Building wheel for wxpython (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: X/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/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'"'"'))' bdist_wheel -d /tmp/pip-wheel-zye96l5z
       cwd: /tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/
  Complete output (140 lines):
  X/python3.7/site-packages/setuptools/dist.py:720: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
    % (opt, underscore_opt)
  X/python3.7/site-packages/setuptools/dist.py:294: DistDeprecationWarning: use_2to3 is ignored.
    warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
  running bdist_wheel
  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.
  
  "X/python" -u build.py build
  Will build using: "X/python"
  3.7.11 (default, Jul 27 2021, 14:32:16)
  [GCC 7.5.0]
  Python's architecture is 64bit
  cfg.VERSION: 4.1.1
  
  Running command: build
  Running command: build_wx
  wxWidgets build options: ['--wxpython', '--unicode', '--gtk3']
  Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl']
  /tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl
  checking build system type... x86_64-pc-linux-gnu
  checking host system type... x86_64-pc-linux-gnu
  checking for toolkit... gtk
  checking for gcc... gcc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.out
  checking for suffix of executables...
  checking whether we are cross compiling... no
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ISO C89... none needed
  checking whether we are using the Intel C compiler... no
  checking how to run the C preprocessor... gcc -E
  checking for grep that handles long lines and -e... /bin/grep
  checking for egrep... /bin/grep -E
  checking whether gcc needs -traditional... no
  checking for g++... g++
  checking whether we are using the GNU C++ compiler... yes
  checking whether g++ accepts -g... yes
  checking whether we are using the Intel C++ compiler... no
  checking whether we are using the Sun C++ compiler... no
  checking for ar... ar
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for unistd.h... yes
  checking for langinfo.h... yes
  checking for wchar.h... yes
  checking for sys/select.h... yes
  checking for cxxabi.h... yes
  checking for an ANSI C-conforming const... yes
  checking for inline... inline
  checking size of short... 2
  checking size of void *... 8
  checking size of int... 4
  checking size of long... 8
  checking size of size_t... 8
  checking size of long long... 8
  checking size of wchar_t... 4
  checking for va_copy... yes
  checking for _FILE_OFFSET_BITS value needed for large files... 64
  checking if large file support is available... yes
  checking for _LARGEFILE_SOURCE value needed for large files... no
  checking whether byte ordering is bigendian... no
  checking for std::wstring in <string>... yes
  checking for std::istream... yes
  checking for std::ostream... yes
  checking for type_traits... yes
  checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins... yes
  checking for libraries directories... /usr/lib/x86_64-linux-gnu /usr/lib
  checking for cos... no
  checking for floor... no
  checking if floating point functions link without -lm... no
  checking for sin... yes
  checking for ceil... yes
  checking if floating point functions link with -lm... yes
  checking for strtoull... yes
  checking for pkg-config... /usr/bin/pkg-config
  checking pkg-config is at least version 0.9.0... yes
  configure: WARNING: Defaulting to the builtin regex library for Unicode build.
  checking for zlib.h >= 1.1.4... yes
  checking for zlib.h... (cached) yes
  checking for deflate in -lz... yes
  checking for png.h > 0.90... yes
  checking for png.h... (cached) yes
  checking for png_sig_cmp in -lpng... yes
  checking for jpeglib.h... yes
  checking for jpeg_read_header in -ljpeg... yes
  checking lzma.h usability... yes
  checking lzma.h presence... yes
  checking for lzma.h... yes
  checking for lzma_code in -llzma... yes
  checking for jbg_dec_init in -ljbig... yes
  checking for LIBTIFF... yes
  checking for expat.h... yes
  checking if expat.h is valid C++ header... yes
  checking for XML_ParserCreate in -lexpat... yes
  checking for GTK+ version...
  checking for pkg-config... (cached) /usr/bin/pkg-config
  checking pkg-config is at least version 0.16... yes
  checking for GTK+ - version >= 3.0.0... Package gtk+-3.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `gtk+-3.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'gtk+-3.0' found
  no
  *** Could not run GTK+ test program, checking why...
  *** The test program failed to compile or link. See the file config.log for the
  *** exact error that occurred. This usually means GTK+ is incorrectly installed.
  configure: error:
  The development files for GTK+ were not found. For GTK+ 2, please
  ensure that pkg-config is in the path and that gtk+-2.0.pc is
  installed. For GTK+ 1.2 please check that gtk-config is in the path,
  and that the version is 1.2.3 or above. Also check that the
  libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
  --libs' are in the LD_LIBRARY_PATH or equivalent.
  
  Error running configure
  ERROR: failed building wxWidgets
  Traceback (most recent call last):
    File "build.py", line 1510, in cmd_build_wx
      wxbuild.main(wxDir(), build_options)
    File "/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/buildtools/build_wxwidgets.py", line 373, in main
      "Error running configure")
    File "/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/buildtools/build_wxwidgets.py", line 85, in exitIfError
      raise builder.BuildError(msg)
  buildtools.builder.BuildError: Error running configure
  Finished command: build_wx (0m6.561s)
  Finished command: build (0m6.561s)
  Command '"X/python" -u build.py build' failed with exit code 1.
  ----------------------------------------
  ERROR: Failed building wheel for wxpython
  Running setup.py clean for wxpython
Failed to build wxpython
Installing collected packages: pillow, wxpython
    Running setup.py install for wxpython ... error
    ERROR: Command errored out with exit status 1:
     command: X/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/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 /tmp/pip-record-a61cuh_4/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /root/.local/include/python3.7m/wxpython
         cwd: /tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/
    Complete output (140 lines):
    X/python3.7/site-packages/setuptools/dist.py:720: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
      % (opt, underscore_opt)
    X/python3.7/site-packages/setuptools/dist.py:294: DistDeprecationWarning: use_2to3 is ignored.
      warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
    running install
    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.
    
    "X/python" -u build.py build
    Will build using: "X/python"
    3.7.11 (default, Jul 27 2021, 14:32:16)
    [GCC 7.5.0]
    Python's architecture is 64bit
    cfg.VERSION: 4.1.1
    
    Running command: build
    Running command: build_wx
    wxWidgets build options: ['--wxpython', '--unicode', '--gtk3']
    Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl']
    /tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for toolkit... gtk
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether we are using the Intel C compiler... no
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking whether gcc needs -traditional... no
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking whether we are using the Intel C++ compiler... no
    checking whether we are using the Sun C++ compiler... no
    checking for ar... ar
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for langinfo.h... yes
    checking for wchar.h... yes
    checking for sys/select.h... yes
    checking for cxxabi.h... yes
    checking for an ANSI C-conforming const... yes
    checking for inline... inline
    checking size of short... 2
    checking size of void *... 8
    checking size of int... 4
    checking size of long... 8
    checking size of size_t... 8
    checking size of long long... 8
    checking size of wchar_t... 4
    checking for va_copy... yes
    checking for _FILE_OFFSET_BITS value needed for large files... 64
    checking if large file support is available... yes
    checking for _LARGEFILE_SOURCE value needed for large files... no
    checking whether byte ordering is bigendian... no
    checking for std::wstring in <string>... yes
    checking for std::istream... yes
    checking for std::ostream... yes
    checking for type_traits... yes
    checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins... yes
    checking for libraries directories... /usr/lib/x86_64-linux-gnu /usr/lib
    checking for cos... no
    checking for floor... no
    checking if floating point functions link without -lm... no
    checking for sin... yes
    checking for ceil... yes
    checking if floating point functions link with -lm... yes
    checking for strtoull... yes
    checking for pkg-config... /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    configure: WARNING: Defaulting to the builtin regex library for Unicode build.
    checking for zlib.h >= 1.1.4... yes
    checking for zlib.h... (cached) yes
    checking for deflate in -lz... yes
    checking for png.h > 0.90... yes
    checking for png.h... (cached) yes
    checking for png_sig_cmp in -lpng... yes
    checking for jpeglib.h... yes
    checking for jpeg_read_header in -ljpeg... yes
    checking lzma.h usability... yes
    checking lzma.h presence... yes
    checking for lzma.h... yes
    checking for lzma_code in -llzma... yes
    checking for jbg_dec_init in -ljbig... yes
    checking for LIBTIFF... yes
    checking for expat.h... yes
    checking if expat.h is valid C++ header... yes
    checking for XML_ParserCreate in -lexpat... yes
    checking for GTK+ version...
    checking for pkg-config... (cached) /usr/bin/pkg-config
    checking pkg-config is at least version 0.16... yes
    checking for GTK+ - version >= 3.0.0... Package gtk+-3.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `gtk+-3.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'gtk+-3.0' found
    no
    *** Could not run GTK+ test program, checking why...
    *** The test program failed to compile or link. See the file config.log for the
    *** exact error that occurred. This usually means GTK+ is incorrectly installed.
    configure: error:
    The development files for GTK+ were not found. For GTK+ 2, please
    ensure that pkg-config is in the path and that gtk+-2.0.pc is
    installed. For GTK+ 1.2 please check that gtk-config is in the path,
    and that the version is 1.2.3 or above. Also check that the
    libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
    --libs' are in the LD_LIBRARY_PATH or equivalent.
    
    Error running configure
    ERROR: failed building wxWidgets
    Traceback (most recent call last):
      File "build.py", line 1510, in cmd_build_wx
        wxbuild.main(wxDir(), build_options)
      File "/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/buildtools/build_wxwidgets.py", line 373, in main
        "Error running configure")
      File "/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/buildtools/build_wxwidgets.py", line 85, in exitIfError
        raise builder.BuildError(msg)
    buildtools.builder.BuildError: Error running configure
    Finished command: build_wx (0m6.605s)
    Finished command: build (0m6.605s)
    Command '"X/python" -u build.py build' failed with exit code 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: X/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a2f2yzyl/wxpython_6f1c8d5a5fe9435693e55e82826753e2/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 /tmp/pip-record-a61cuh_4/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /root/.local/include/python3.7m/wxpython Check the logs for full command output.
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
如果wxPython安装失败,有几个可能的原因。首先,您需要确认您的网络连接是否正常。如果网络连接不稳定或速度较慢,可能导致安装失败。您可以尝试使用其他网络连接或等待网络状况好转后重新尝试安装。 其次,您需要检查您使用的安装命令是否正确。确保您使用的命令是正确的,并且所引用的镜像地址是可用的。您可以尝试复制并粘贴命令,确保没有输入错误或遗漏任何字符。 如果您仍然无法解决问题,您可以尝试使用其他的wxPython安装方法。例如,您可以尝试从其他可靠的源或网站下载wxPython安装包,并按照其提供的安装说明进行安装。确保您下载的安装包与您的操作系统和Python版本兼容。 另外,您还可以尝试在安装过程中禁用防火墙或杀毒软件,以确保它们不会阻止wxPython安装。 如果问题仍然存在,我们建议您参考官方文档或社区支持,以获取更详细和具体的解决方案。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [安装Python - wxPython失败的解决方法](https://blog.csdn.net/swmnyjy/article/details/105528150)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [解决windows安装wxPython安装失败、速度过慢及PyCharm上wx包爆红问题](https://blog.csdn.net/m0_61163395/article/details/129270407)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值