如何在另一个 Python 版本下安装 wxPython?

如何在另一个 Python 版本下安装 wxPython?

我正在尝试在我的 Ubuntu 20.04 上运行一个应用程序 (PsychoPy)。由于一些技术问题,我需要使用与默认安装不同的 Python 安装。因此本指南,我已经安装了 python 3.6,它可以正常工作。当我尝试使用 python 3.6 安装 wxPython 时出现了问题。以下另一位导游以及 wxPython 官方网站,我在终端中输入了以下内容:

python3.6 -m pip install --user wxpython

开始构建轮子时似乎可以正常工作,但最终却出现了错误。错误消息很长。构建报告中的最后一件事是:

"/usr/local/bin/python3.6" /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/bin/waf-2.0.19 --wx_config=/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/local/bin/python3.6" --out=build/waf/3.6/gtk3 configure build
  Setting top to                           : /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c
  Setting out to                           : /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/waf/3.6/gtk3
  Checking for 'gcc' (C compiler)          : /usr/bin/gcc
  Checking for 'g++' (C++ compiler)        : /usr/bin/g++
  Checking for program 'python'            : /usr/local/bin/python3.6
  Checking for python version >= 2.7.0     : 3.6.11
  python-config                            : /usr/local/bin/python3.6m-config
  Asking python-config for pyext '--cflags --libs --ldflags' flags : yes
  Testing pyext configuration                                      : Could not build python extensions
  The configuration failed
  (complete log in /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/waf/3.6/gtk3/config.log)
  Command '"/usr/local/bin/python3.6" /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/bin/waf-2.0.19 --wx_config=/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/local/bin/python3.6" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.
  Finished command: build_py (0.795s)
  Finished command: build (4m37.280s)
  Command '"/usr/local/bin/python3.6" -u build.py build' failed with exit code 1.
  ----------------------------------------ESC[0m
ESC[31m  ERROR: Failed building wheel for wxpythonESC[0m
ESC[?25h  Running setup.py clean for wxpython
Failed to build wxpython
Installing collected packages: wxpython
    Running setup.py install for wxpython ... ESC[?25lerror
ESC[31m    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-gbhtkl1i/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/jakub/.local/include/python3.6m/wxpython

整个日志的最后一件事是:

Running command: build_py
    Checking for /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/bin/waf-2.0.19...
    "/usr/local/bin/python3.6" /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/bin/waf-2.0.19 --wx_config=/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/local/bin/python3.6" --out=build/waf/3.6/gtk3 configure build
    Setting top to                           : /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c
    Setting out to                           : /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/waf/3.6/gtk3
    Checking for 'gcc' (C compiler)          : /usr/bin/gcc
    Checking for 'g++' (C++ compiler)        : /usr/bin/g++
    Checking for program 'python'            : /usr/local/bin/python3.6
    Checking for python version >= 2.7.0     : 3.6.11
    python-config                            : /usr/local/bin/python3.6m-config
    Asking python-config for pyext '--cflags --libs --ldflags' flags : yes
    Testing pyext configuration                                      : Could not build python extensions
    The configuration failed
    (complete log in /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/waf/3.6/gtk3/config.log)
    Command '"/usr/local/bin/python3.6" /tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/bin/waf-2.0.19 --wx_config=/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/local/bin/python3.6" --out=build/waf/3.6/gtk3 configure build ' failed with exit code 1.
    Finished command: build_py (0.716s)
    Finished command: build (0m1.376s)
    Command '"/usr/local/bin/python3.6" -u build.py build' failed with exit code 1.
    ----------------------------------------ESC[0m
ESC[31mERROR: Command errored out with exit status 1: /usr/local/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9uhulhbe/wxpython_053e05edce4148ecbc0f1844ca0d9b3c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-gbhtkl1i/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/jakub/.local/include/python3.6m/wxpython Check the logs for full command output.

如何在 Ubuntu 20.04 中的 Python 3.6 下安装 wxPython?

答案1

使用以下命令wxpython在 Ubuntu 20.04 上安装:

python3 -m pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython

答案2

你可能想尝试

conda install -c asmeurer pango

相关内容