我的Python不能連接到互聯網,因爲上次我的Windows更新。的Python LocationValueError:沒有主機指定
當我點子東西,錯誤是這樣
if host.startswith('['):
AttributeError: 'NoneType' object has no attribute 'startswith'
這只是我不能在互聯網上的任何點子,任何東西。
然後我想,也許出了點問題,我的系統,所以我想檢查是否「請求」工作正常。但主機錯誤就像
r = requests.get('http://www.baidu.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Program Files (x86)\Anaconda3\lib\site-packages\requests\api.py",
line 70, in get
return request('get', url, params=params, **kwargs)
File "D:\Program Files (x86)\Anaconda3\lib\site-packages\requests\api.py",
line 56, in request
return session.request(method=method, url=url, **kwargs)
File "D:\Program Files (x86)\Anaconda3\lib\site-
packages\requests\sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "D:\Program Files (x86)\Anaconda3\lib\site-
packages\requests\sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "D:\Program Files (x86)\Anaconda3\lib\site-
packages\requests\adapters.py", line 390, in send
conn = self.get_connection(request.url, proxies)
File "D:\Program Files (x86)\Anaconda3\lib\site-
packages\requests\adapters.py", line 291, in get_connection
conn = proxy_manager.connection_from_url(url)
File "D:\Program Files (x86)\Anaconda3\lib\site-
packages\requests\packages\urllib3\poolmanager.py", line 222, in
connection_from_url
return self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
File "D:\Program Files (x86)\Anaconda3\lib\site-
packages\requests\packages\urllib3\poolmanager.py", line 331, in
connection_from_host
self.proxy.host, self.proxy.port, self.proxy.scheme)
File "D:\Program Files (x86)\Anaconda3\lib\site-
packages\requests\packages\urllib3\poolmanager.py", line 167, in
connection_from_host
raise LocationValueError("No host specified.")
requests.packages.urllib3.exceptions.LocationValueError: No host
specified.
我已經使用「請求」幾百次,然後我的電腦出錯了。而且我以前從來沒有見過這樣的錯誤。順便說一句,我的互聯網工作的完美,否則我不能從這裏提一個問題。
我不明白什麼是錯的我的電腦或主機文件,我會很感激,如果有人能幫助我。
人可以幫我???? – user8592667