installing urllib in Python3.7 - here i encountered issues. I would like to import urllib to use the function 'request'.
However, I encountered an error when trying to do so. I tried pip install urllib but still had the same error. I am using Python 3.7.x Really appreciate any help. i do import urllib.request using this following code:
import urllib.request, urllib.parse, urllib.error
fhand = urllib.request.urlopen('data.pr4e.org/romeo.txt')
counts = dict()
for line in fhand:
words = line.decode().split()
for word in words:
counts[word] = counts.get(word, 0) + 1
print(counts)
but it gives me this error: ModuleNotFoundError:
No Module named 'urllib.parse'; 'urllib' is not a package
pip install urllib3
if i do so i get back this:
root@mx:/home/martin# pip install urllib3
Requirement already satisfied: urllib3 in /usr/lib/python2.7/dist-packages (1.24.1)
root@mx:/home/martin# ^C
root@mx:/home/martin#
well this is funny - since it points out some path to python 2.7
Alternatively, the manpage (https://urllib3.readthedocs.io/en/latest/ ) suggests to go this way: grab the latest source code from GitHub:
Question
tarifa
hello dear Experts,
installing urllib in Python3.7 - here i encountered issues. I would like to import urllib to use the function 'request'.
However, I encountered an error when trying to do so. I tried pip install urllib but still had the same error. I am using Python 3.7.x Really appreciate any help. i do import urllib.request using this following code:
but it gives me this error: ModuleNotFoundError:
No Module named 'urllib.parse'; 'urllib' is not a package
if i look at this page: https://urllib3.readthedocs.io/en/latest/
they recomend to install this way:
well this is funny - since it points out some path to python 2.7
Alternatively, the manpage (https://urllib3.readthedocs.io/en/latest/ ) suggests to go this way: grab the latest source code from GitHub:
this i did not try yet! But i will do so
Link to comment
https://www.neowin.net/forum/topic/1393679-installing-urllib-in-python-36-fails-confusion-with-python-27/Share on other sites
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now