名为
python3-wxgtk4.0
在Ubuntu 22.04.1 LTS上,正如它的名字所说,可能是用gtk4构建的:
$ apt-cache policy python3-wxgtk4.0
python3-wxgtk4.0:
Installed: 4.0.7+dfsg-13build1
Candidate: 4.0.7+dfsg-13build1
Version table:
*** 4.0.7+dfsg-13build1 500
500 http://ch.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
100 /var/lib/dpkg/status
但是这个包的版本,
4.0.7
,os太旧,无法使用。
当尝试使用
pip
,看来wxWidgets是用gkt3自动编译的:
$ pip3 --verbose install wxPython==4.1.1
Using pip 22.3.1 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
Collecting wxPython==4.1.1
Using cached wxPython-4.1.1.tar.gz (66.0 MB)
Running command python setup.py egg_info
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
warnings.warn(
/usr/local/lib/python3.10/dist-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:317: DistDeprecationWarning: use_2to3 is ignored.
warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
running egg_info
creating /tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info
writing /tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/dependency_links.txt
writing entry points to /tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/entry_points.txt
writing requirements to /tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/sphinx/build'
warning: no previously-included files matching '.git' found under directory 'wx'
warning: no previously-included files matching '*.pyc' found under directory 'wx'
warning: no previously-included files matching '__pycache__' found under directory 'wx'
adding license file 'LICENSE.txt'
writing manifest file '/tmp/pip-pip-egg-info-7naa9j1r/wxPython.egg-info/SOURCES.txt'
Preparing metadata (setup.py) ... done
Requirement already satisfied: pillow in /usr/local/lib/python3.10/dist-packages (from wxPython==4.1.1) (9.1.0)
Requirement already satisfied: six in /usr/local/lib/python3.10/dist-packages (from wxPython==4.1.1) (1.16.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from wxPython==4.1.1) (1.23.4)
Building wheels for collected packages: wxPython
Running command python setup.py bdist_wheel
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
warnings.warn(
/usr/local/lib/python3.10/dist-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
/usr/local/lib/python3.10/dist-packages/setuptools/dist.py:317: 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.
"/usr/bin/python3" -u build.py build
Will build using: "/usr/bin/python3"
3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.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-e18fhds7/wxpython_2fcd6d486f1646cbac69c59578dd763b/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
(...many other checks)
我很好奇,因此提出了问题;可以让pip取吗
wxPython==4.1.1
并且使用gtk4而不是gtk3来编译它?当然,如果这有意义的话。
旁注:
最新
wxPython 4.2.0
不幸的是,在Ubuntu 22.04.1上安装pip时出现了错误:
$ pip3 install -U wxPython
Requirement already satisfied: wxPython in /usr/lib/python3/dist-packages (4.0.7)
Collecting wxPython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
à python setup.py egg_info did not run successfully.
â exit code: 1
â°â> [12 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-a9emvjpo/wxpython_892c7b008de74c9db8d68d1c5c97e8a5/setup.py", line 27, in <module>
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
File "/tmp/pip-install-a9emvjpo/wxpython_892c7b008de74c9db8d68d1c5c97e8a5/buildtools/config.py", line 30, in <module>
from attrdict import AttrDict
File "/usr/local/lib/python3.10/dist-packages/attrdict/__init__.py", line 5, in <module>
from attrdict.mapping import AttrMap
File "/usr/local/lib/python3.10/dist-packages/attrdict/mapping.py", line 4, in <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
à Encountered error while generating package metadata.
â°â> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.