Install numpy on python3.3 - Install pip for python3

numpy, python-3.x

Solution

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

Problem

For python 3.2 I used `sudo apt-get install python3.2-numpy`.It worked. What to do for python3.3? Nothing I could think of works. Same goes for scipy, etc. Thanks. Edit: this is how it looks like ``` radu@sunlit-inspired:~$ python3 Python 3.3.2 (default, Jul 3 2013, 10:17:40) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'numpy' ```

Original source

Related problems