Reputation: 1
I've python 3.4.1 installed, and need to run python 2 script. I've installed python 2.7.5 by running make install
. When i run my script it writes:
Traceback (most recent call last):
File "/root/roseltorg/run.py", line 2, in <module>
import requests
ImportError: No module named requests
Then I'm trying to install requests module but:
pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python3.4/site-packages/requests-2.11.1-py3.4.egg
Cleaning up...
How to force install this module for python 2.7?
Upvotes: 0
Views: 756
Reputation: 15370
It is installing to python 3.4 with pip
which means pip
pointing to pip3
. Try doing this
pip2 install requests
Upvotes: 1
Reputation: 3741
I prefer using virtualenv in such scenario.
virtualenv -p path_to_python2.7 .(current dir)
source bin/activate
pip install requests
Upvotes: 1