Reputation: 211
I installed pip, but if I try to install a package with
python -m pip install requests
it says
/usr/local/bin/python: No module named pip
How can I figure out where the problem is?
The problem is not with pip, but that the modules are not installed in the right way, so I can’t use them in Python. I am using Ubuntu 15.04 (Vivid Vervet).
Upvotes: 16
Views: 61911
Reputation: 1487
to install pip in the version you want: python3.VERSIONYOUINSTALLED -m ensurepip and then you can use with python3.VERSIONYOUINSTALLED -m pip install PACKAGEYOUWANT
Upvotes: 1
Reputation: 848
I had to do something similar, and tom's answer didn't quite work on DigitalOcean and Ubuntu 14.04.05 (Trusty Tahr).
apt-get install python-setuptools
easy_install pip
apt-get install python3-dev
pip install --upgrade setuptools
pip install cryptography
pip install paramiko
Upvotes: 1
Reputation: 6193
My openSUSE box at work did not have pip installed and YaST did not find it. I figured out that YaST was only pointing to a local package-repository which apparently was missing pip.
I have added the official openSUSE repository, which I found on Package repositories and then was able to find and install pip.
Upvotes: 2
Reputation: 3860
Pip is a Python packaging module that helps us to install Python libraries. To install Python libraries/modules, you need to install pip -
sudo apt-get install python-setuptools
sudo easy_install pip
sudo apt-get update
which pip # To check pip install or not
pip install requests
Upvotes: 1
Reputation: 821
My situation is that the Python 3 works fine, but pip 3 does not work (the default Python version is Python 2.7, but it doesn't matter).
I solve this problem by the following command:
apt-get purge python3-pip
apt-get install -y python3-pip
And if you are not the root user, you may need to add sudo
in the beginning of the command.
Upvotes: 15
Reputation: 136
See if the package is installed in the site-packages of your Python version.
It gives the path where all your packages reside for particular Python version.
import sys, os; print os.sep.join([sys.prefix, 'lib', 'python' + sys.version[:3], 'site-packages'])
;
If you find requests
there, then import requests
should work. Otherwise, add the above path to your Python interpreter's path by using the below code.
import sys
sys.path.append("<path>")
Upvotes: -1