简体   繁体   中英

How to install numpy for python 2.7.9

I have two versions of python- 2.7.6 & 2.7.9 and numpy is installed for python 2.7.6 . I can't understand how to install numpy for python 2.7.9.

When I use pip2 install --upgrade numpy , it installs and updates for python 2.7.6.

How do I install numpy particularly for python 2.7.9?

*****edit*****

I am trying to find the location of python 2.7.9.

If i type python or python2 , I am using python 2.7.9. which -a python gives me two paths, /usr/bin/python and /usr/local/bin/python and when I used the first path, it gives me this output- Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python2.7/dist-packages Cleaning up...

If I used the second path, i get this output- /usr/local/bin/python: No module named pip

which -a pip command gives /usr/local/bin/pip /usr/bin/pip

which -a easy_install gives /usr/local/bin/easy_install /usr/bin/easy_install

which -a python gives /usr/local/bin/python /usr/bin/python

*****edit2*****

My OS is Ubuntu 14.04lts.

/usr/local/bin/pip --version gives pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7) .

/usr/bin/pip --version gives pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)

/usr/local/bin/easy_install --version gives setuptools 32.1.2 from /usr/local/lib/python2.7/dist-packages (Python 2.7)

/usr/bin/easy_install --version gives setuptools 3.3

/usr/local/bin/python --version gives Python 2.7.9

/usr/bin/python --version gives Python 2.7.6

*****edit3*****

sudo /usr/local/bin/easy_install pip gives following output-

Searching for pip
Best match: pip 1.5.4
Adding pip 1.5.4 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Using /usr/lib/python2.7/dist-packages
Processing dependencies for pip
Finished processing dependencies for pip

*****edit4*****

sys.path = [
'/home/kevmepls',
'/home/kevmepls/Documents/DeepLearning-Caffe/caffe/python',
'/usr/local/lib/python27.zip',
'/usr/local/lib/python2.7',
'/usr/local/lib/python2.7/plat-linux2',
'/usr/local/lib/python2.7/lib-tk',
'/usr/local/lib/python2.7/lib-old',
'/usr/local/lib/python2.7/lib-dynload',
'/home/kevmepls/.local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/site-packages',
]
USER_BASE: '/home/kevmepls/.local' (exists)
USER_SITE: '/home/kevmepls/.local/lib/python2.7/site-packages' (exists)
ENABLE_USER_SITE: True

Like this:

/path/to/python279 -m pip install --user numpy

If you are seeing the error No module named pip , then first install pip as described below:

  1. Download this file: get_pip.py
  2. Execute sudo /path/to/python279 get_pip.py
  3. Try again the /path/to/python279 -m pip install --user numpy

I believe this has to do with your path variables. Currently, I believe your path variable points to your installation of Python 2.7.6. Check your path variable for python, and hopefully changing it to the correct installation fixes your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM