import requests
url = 'http://www.sogou.com/web?query=%E5%91%A8%E6%9D%B0%E4%BC%A6%27
resp = requests.get(url)
print(resp)
在python语句运行的时候提示以下报错,该这么处理
D:\project001\Scripts\python.exe C:\Users\Administrator\PycharmProjects\pythonProject\part\part01.py
D:\python\lib\site-packages\requests_init.py:80: RequestsDependencyWarning: urllib3 (1.26.7) or chardet (4.0.0) doesn't match a supported version!
RequestsDependencyWarning)
Traceback (most recent call last):
File "C:\Users\Administrator\PycharmProjects\pythonProject\part\part01.py", line 1, in
import requests
File "D:\python\lib\site-packages\requests_init.py", line 83, in
from pip._internal.compat import WINDOWS
ModuleNotFoundError: No module named 'pip._internal.compat'
Process finished with exit code 1
发现是冲突了,pip requests重新卸载安装以下就好了
pip uninstall requests
pip install requests==2.28.0
就好了