urllib.request module fails to install in my system
Solution 1
urllib.request is only available in python3 branch. See the following post for more info. urllib.request in Python 2.7
Solution 2
In python3 you must use urllib3 module.
$ pip3 install urllib3
Or if you're using a virtual env:
$ pip install urllib3
Solution 3
In python 2 ,you simply use urllib for example
import urllib
htmlfile=urllib.urlopen("your url")
htmltext=htmlfile.read()
in python 3,you need to use urllib.request
import urllib.request
htmlfile=urllib.request.urlopen("your url")
htmltext=htmlfile.read()
Solution 4
For Python3 in cmd,
pip install urllib3
Or if you're using a anaconda:
conda install urllib3
Hope, this will help you
Mounarajan
Love whatever you do Never expect anything from it you will be most successful and unique in this world :) Interested in knowing more about me just visit more about me in linkedin www.linkedin.com/in/mounarajan Connect with me via social media: www.facebook.com/mouna.rajan www.linkedin.com/in/mounarajan Connect with me via Email: [email protected] Connect with me via Skype: Skype ID : mounarajan
Updated on February 19, 2020Comments
-
Mounarajan about 4 years
Tried installing urllib.request module using below command
sudo pip install urllib.request
but it returned
Downloading/unpacking urllib.request Could not find any downloads that satisfy the requirement urllib.request Cleaning up... No distributions at all found for urllib.request Storing debug log for failure in /home/mounarajan/.pip/pip.log
How can I install this module?
-
Mounarajan about 9 yearsyeah i using python 3
-
abcd about 9 yearswhat do you mean, "python3 filename.py"? what is "filename.py"?
-
Mounarajan about 9 yearspython3 is verson name and filename is the name of the file in which u save you program in your directory so python3 filename.py