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:
While I agree that in some instances you should be wary of the government, shouldn't we also be wary of corporations that have the money, reach and power of many governments?
Having good regulations is essential for population protection (from corps trying to make more money than the other guy). At least we can vote in and out governments, but these days your choice of consumer tech is now only a few very large players. And we also know "consumers" are idiots and need protecting, it's literally the government's job to deliver those services.
Good news, and about time too, but with Office 2019 perpetual licence no longer being able to edit files, is this completely stuffing up the entire suite, or removing the ability to edit files from within OneDrive? Sounds stupid to have a kill switch like that, and they could totally fine a way to update the certificate if that's the reason behind it..
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:
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
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