Mou*_*jan 10 python ubuntu sudo pip urllib
尝试使用以下命令安装urllib.request模块
sudo pip install urllib.request
Run Code Online (Sandbox Code Playgroud)
但它回来了
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
Run Code Online (Sandbox Code Playgroud)
我该如何安装这个模块?
小智 7
在python3中,您必须使用urllib3模块.
$ pip3 install urllib3
Run Code Online (Sandbox Code Playgroud)
或者,如果您使用的是虚拟环境:
$ pip install urllib3
Run Code Online (Sandbox Code Playgroud)
小智 6
在python 2中,您只需使用urllib例如
import urllib
htmlfile=urllib.urlopen("your url")
htmltext=htmlfile.read()
Run Code Online (Sandbox Code Playgroud)
在python 3中,您需要使用urllib.request
import urllib.request
htmlfile=urllib.request.urlopen("your url")
htmltext=htmlfile.read()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
68286 次 |
最近记录: |