|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 昕颖 于 2020-4-2 00:13 编辑
Traceback (most recent call last):
File "C:\Users\昕颖\Desktop\百度贴吧.py", line 25, in <module>
get_img(open_url(url))
File "C:\Users\昕颖\Desktop\百度贴吧.py", line 8, in open_url
page=urllib.requset.urlopen(req)
AttributeError: module 'urllib' has no attribute 'requset'
这样 应该是没有安装request模块原因吧 然后我又去找了安装方法,但好像说我pip版本过低
C:\Users\昕颖>pip install requests
Requirement already satisfied: requests in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (2.23.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (2019.11.28)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (1.25.8)
Requirement already satisfied: idna<3,>=2.5 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (2.9)
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
然后现在我改怎么办
然后我升级了pip后 再次执行pip install requests后
C:\Users\昕颖>pip install requests
Requirement already satisfied: requests in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (2.23.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (1.25.8)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (2.9)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\昕颖\appdata\local\programs\python\python38-32\lib\site-packages (from requests) (2019.11.28)
这样是安装成功了吗???但是执行程序还是
AttributeError: module 'urllib' has no attribute 'requset'
卡这里好几天了
|
|