我正在使用“ urilib.request”,但失败了,这里是错误消息:
C:\ProgramData\Anaconda3\python.exe "E:/python project/practice.py"
Traceback (most recent call last):
File "E:/python project/practice.py", line 2, in <module>
urlrequest.urlopen('https://www.baidu.com')
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 548, in _open
'unknown_open', req)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 1387, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
请参阅以下代码
import urllib.request as urlrequest
urlrequest.urlopen('https://www.baidu.com')
我尝试安装pyopenssl
pip install pyopenssl
但是系统提醒我:它已经存在