Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)

While installing pip for Python 3.6, I am getting ModuleNotFoundError below:

 Traceback (most recent call last):

    File "script.py", line 6, in <module>

     import requests

 ModuleNotFoundError: No module named 'requests'

Python's and pip's I have in the system are:

python3

python3.5

python3.5m

python3.6

python3m

python3-config

python3.5-config

python3.5m-config

python3.6m

python3m-config  

pip

pip3

pip3.5

1 Answer

0 votes
by (108k points)

I think you are working with Ubuntu 16.04 LTS, in that case, you'll need to use a PPA:

sudo add-apt-repository ppa:jonathonf/python-3.6  # (only for 16.04 LTS)

After that, run the following code:

sudo apt update

sudo apt install python3.6

sudo apt install python3.6-dev

sudo apt install python3.6-venv

wget https://bootstrap.pypa.io/get-pip.py

sudo python3.6 get-pip.py

sudo ln -s /usr/bin/python3.6 /usr/local/bin/python3

sudo ln -s /usr/local/bin/pip /usr/local/bin/pip3

# Do this only if you want python3 to be the default Python

# instead of python2 (may be dangerous, esp. before 2020):

# sudo ln -s /usr/bin/python3.6 /usr/local/bin/python

You can also check the version of python with the below set of code:

python --version   # (this will reflect your choice, see above)

python3 --version

$(head -1 `which pip` | tail -c +3) --version

$(head -1 `which pip3` | tail -c +3) --version

Related questions

0 votes
1 answer
asked Nov 27, 2020 in Python by bharathbk (280 points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...