Python3: ImportError: No module named '_ctypes' when using Value from module multiprocessing

問題:

I am using Ubuntu and have installed Python 2.7.5 and 3.4.0.我正在使用 Ubuntu 並安裝了 Python 2.7.5 和 3.4.0。 In Python 2.7.5 I am able to successfully assign a variable x = Value('i', 2) , but not in 3.4.0.在 Python 2.7.5 中,我能夠成功分配一個變量x = Value('i', 2) ,但在 3.4.0 中不能。 I am getting:我正進入(狀態:

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'

I just updated to 3.3.2 through installing the source of 3.4.0.我剛剛通過安裝3.4.0的源更新到3.3.2。 It installed in /usr/local/lib/python3.4 .它安裝在/usr/local/lib/python3.4

Did I update to Python 3.4 correctly?我是否正確更新到 Python 3.4?

One thing I noticed that Python 3.4 is installed in usr/local/lib , while Python 3.3.2 is still installed in usr/lib , so it was not overwritten.我注意到 Python 3.4 安裝在usr/local/lib 中的一件事,而 Python 3.3.2 仍然安裝在usr/lib 中,所以它沒有被覆蓋。


解決方案:

參考一: https://en.stackoom.com/question/1pNkj
參考二: https://stackoom.com/question/1pNkj
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章