Install numpy for python 2.7 and not 3.4
16,829
Solution 1
First, do pip uninstall numpy
and pip2 uninstall numpy
just to clean up any old files.
Then, since you are on Ubuntu, you should just run
sudo apt-get install python-numpy
This will install numpy for python2. If you later choose you want it for python3, just run
sudo apt-get install python3-numpy
Solution 2
sudo pip2 install numpy==1.15.0
You need to specify numpy version because latest version requires Python version >= 3.5.
Related videos on Youtube
Author by
Sibi
Updated on September 15, 2022Comments
-
Sibi over 1 year
I have been literally struggling to install numpy for python 2.7 and not 3.4 both of which are on my ubuntu. I have tried:
sudo pip2 install numpy
but it says
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib/python2.7/dist-packages
but when I go to the python shell, and type
import numpy
, it throws anImportError
python --version prints `Python 2.7.5`
I have no idea what the problem is even after looking at various answers to other SO questions. Is numpy installed and I'm not able to use it for some reason or isn't it installed? Please help.
-
jonrsharpe almost 8 yearsI would recommend you start using
virtualenv
, which allows you to easily control (and reproduce) combinations of interpreters and installed packages.
-