In the solution below I used python3.4
as binary, but it's safe to use with any version or binary of python. it works fine on windows too (except the downloading "get-pip.py" with wget
obviously but just save the file locally and run it with python, see below).
This is great if you have multiple versions of python installed, so you can manage external libraries per python version.
So first, I'd recommend get-pip.py
, it's great to install pip:
wget https://bootstrap.pypa.io/get-pip.py
Then you need to install pip for your version of python, I have python3.4
so for me this is the command:
python3.4 get-pip.py
Now pip is installed for this version and I'll use pip "contextualized" to that version this way:
python3.4 -m pip
So to install numpy for python3.4 I'll use :
python3.4 -m pip install numpy
Note that numpy
is quite the heavy library. I thought my system was hanging and failing.
But using the verbose option, you can see that the system is fine :
python3.4 -m pip install numpy -v
This may tell you that you lack python.h but you can easily get python headers:
Of course you want to keep using your python version in those commands
On Debian-like (Debian, Ubuntu, Kali, ...) :
apt-get install python34-dev
On RHEL (Red hat, CentOS, Fedora) it would be something like this:
yum install python34-devel
or more recently
dnf install python34-devel
If that doesn't work for you, there's a great topic with more coverage: fatal error: Python.h: No such file or directory
Finally, once you've got python header files you can just rerun the pip install command:
python3.4 -m pip install numpy -v