Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Ubuntu 12.04 with Python 2.7 and 3.2
Following this page I installed requests module.

$ sudo pip install requests

However, it only works for Python 2 but not Python 3:

$ python
Python 3.2.3 (default, Apr 10 2013, 06:11:55) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named requests
>>> 

How should I install the requests module so it can work for both my Python versions?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Answered by OP:

I figured it out by following various answers from here. The answer is I have to have pip-3.2 installed first. I am not sure all steps are necessary though:

$ sudo apt-get install python3-pip
$ sudo apt-get install python3-setuptools
$ sudo python3 -m easy_install pip
...
Installing pip script to /usr/local/bin
Installing pip-3.2 script to /usr/local/bin
.. Now I get pip-3.2:

$ sudo pip-3.2 install requests
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.