我正在使用Ubuntu,并已安装Python 2.7.5和3.4.0。在Python 2.7.5中,我可以成功地分配一个变量x = Value('i', 2)
,但在3.4.0中却不行。我收到了以下反馈:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/multiprocessing/context.py", line 132, in Value
from .sharedctypes import Value
File "/usr/local/lib/python3.4/multiprocessing/sharedctypes.py", line 10, in <
module>
import ctypes
File "/usr/local/lib/python3.4/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: No module named '_ctypes'
我刚刚通过安装3.4.0的源代码升级到了3.3.2。它被安装在了/usr/local/lib/python3.4。
请问我是正确地升级到了Python 3.4吗?
我注意到一件事情,Python 3.4被安装在了usr/local/lib,而Python 3.3.2仍然安装在usr/lib,所以它没有被覆盖。
libffi-dev
依赖,因此无法构建_ctypes
。可以考虑使用deadsnakes PPA代替。 - Eryk Sun