我在Python 3.7.5上安装wxPython4时遇到问题
$ pip3 install wxpython
Defaulting to user installation because normal site-packages is not writeable
Collecting wxpython
Using cached wxPython-4.1.0.tar.gz (65.8 MB)
Requirement already satisfied: pillow in ./.local/lib/python3.7/site-packages (from wxpython) (7.1.2)
Requirement already satisfied: six in ./.local/lib/python3.7/site-packages (from wxpython) (1.14.0)
Requirement already satisfied: numpy in ./.local/lib/python3.7/site-packages (from wxpython) (1.18.4)
Building wheels for collected packages: wxpython
Building wheel for wxpython (setup.py) ... \
....
File "/usr/lib/python3/dist-packages/Cython/Compiler/ExprNodes.py", line 2844
await = None
^
SyntaxError: invalid syntax
我不确定是什么问题。在Python3中所做的更改,所以await现在是一个特殊的关键字。是否使Python2与Python3混淆?
如果我做这里推荐的事情
https://askubuntu.com/questions/1073145/how-to-install-wxpython-4-ubuntu-18-04
首先我通过以下方式找到它:
sudo apt search python3-wx我用以下命令安装了最新的wxpython:
sudo apt-get install python3-wxgtk4.0 python3-wxgtk-webview4.0python3-wxgtk-media4.0您也可以尝试使用突触来安装它,如果愿意,可以选择方式。
我遇到其他错误
In [1]: import wx
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-03faa7660341> in <module>
----> 1 import wx
/usr/lib/python3/dist-packages/wx/__init__.py in <module>
15 # Import all items from the core wxPython module so they appear in the wx
16 # package namespace.
---> 17 from wx.core import *
18
19
/usr/lib/python3/dist-packages/wx/core.py in <module>
10 """
11
---> 12 from ._core import *
13
14 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
ModuleNotFoundError: No module named 'wx._core'
这可能是由于缺少依赖项。
我认为这是由于Cython 0.26和Python 3.7之间不兼容的问题。请参阅有关SerpentAI的答案。