I am using Ubuntu and have installed Python 2.7.5 and 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. 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. It installed in /usr/local/lib/python3.4.
Did I update to Python 3.4 correctly?
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.
Installing
libffi-dev
and re-installing python3.7 fixed the problem for me.to cleanly build py 3.7
libffi-dev
is required or else later stuff will failIf using RHEL/Fedora:
or
If using Debian/Ubuntu:
Detailed steps to install Python 3.7 in CentOS or any redhat linux machine:
Thought I'd add the Centos installs:
Check python version:
python3 -V
Create virtualenv:
virtualenv -p python3 venv
On a fresh Debian image, cloning https://github.com/python/cpython and running:
And then
Got 3.7 installed and working for me.
SLIGHT UPDATE
Looks like I said I would update this answer with some more explanation and two years later I don't have much to add.
python-dev
might be necessary.altinstall
as opposed toinstall
argument in the make command.Aside from that I guess the choice would be to either read through the cpython codebase looking for
#include
directives that need to be met, but what I usually do is keep trying to install the package and just keep reading through the output installing the required packages until it succeeds.Reminds me of the story of the Engineer, the Manager and the Programmer who's car rolls down a hill.