我正在 ubuntu-22.04 中安装 wxPython,但是下载后它没有安装,而是给了我一个错误,你可以看到...
>>>Installing collected packages: wxPython
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
╰─> [140 lines of output]
/home/boss/.local/lib/python3.10/site-packages/setuptools/dist.py:772: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
warnings.warn(
/home/boss/.local/lib/python3.10/site-packages/setuptools/config/setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
/home/boss/.local/lib/python3.10/site-packages/setuptools/dist.py:318: DistDeprecationWarning: use_2to3 is ignored.
warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
running install
/home/boss/.local/lib/python3.10/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.
"/usr/bin/python3" -u build.py build
Will build using: "/usr/bin/python3"
3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.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-k1_ee31n/wxpython_d14f6b15c6be4966bf59cdf6bba274fb/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... /usr/bin/grep
checking for egrep... /usr/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... no
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... no
checking for png.h... (cached) no
configure: WARNING: system png library not found or too old, will use built-in instead
checking whether png.c file exists... yes
checking for jpeglib.h... no
configure: WARNING: system jpeg library not found, will use built-in instead
checking whether jpeglib.h file exists... yes
checking lzma.h usability... no
checking lzma.h presence... no
checking for lzma.h... no
checking for jbg_dec_init in -ljbig... no
checking for LIBTIFF... not found via pkg-config
checking for tiffio.h... no
configure: WARNING: system tiff library not found, will use built-in instead
checking whether tiff.h file exists... 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... no
checking for GTK+ - version >= 3.0.0... no
*** A new enough version of pkg-config was not found.
*** See http://pkgconfig.sourceforge.net
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 "/tmp/pip-install-k1_ee31n/wxpython_d14f6b15c6be4966bf59cdf6bba274fb/build.py", line 1510, in cmd_build_wx
wxbuild.main(wxDir(), build_options)
File "/tmp/pip-install-k1_ee31n/wxpython_d14f6b15c6be4966bf59cdf6bba274fb/buildtools/build_wxwidgets.py", line 372, in main
exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
File "/tmp/pip-install-k1_ee31n/wxpython_d14f6b15c6be4966bf59cdf6bba274fb/buildtools/build_wxwidgets.py", line 85, in exitIfError
raise builder.BuildError(msg)
buildtools.builder.BuildError: Error running configure
Finished command: build_wx (0m7.799s)
Finished command: build (0m7.799s)
Command '"/usr/bin/python3" -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.
我已经运行了很多命令
像这样
sudo apt install -y doxygen
sudo apt install -y graphviz
python3 -m pip install wxPython
pip install wheel
pip install nes-py
pip install Cmake
pip install nes-py --no-cache-dir
pip install sip==5.5.0
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython
但我没得到它。
答案1
构建失败错误表明您的系统上没有 GTK 3 开发库。
checking for GTK+ - version >= 3.0.0... no
这意味着你缺少这些库。运行sudo apt install libgtk-3-dev
并查看是否pip install
正常工作。