win10代理上网远程开发python pip安装软件包
代码:
C:\windows\system32>set http_proxy=10.xxx.xxx.xxx:xxxx
C:\windows\system32>set https_proxy=10.xxx.xxx.xxx:xxxx
C:\windows\system32>pip --trusted-host=pypi.org --trusted-host=files.pythonhosted.org install requests --user
报错:
Collecting requests
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
status = self.run(options, args)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
resolver.resolve(requirement_set)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
self._resolve_one(requirement_set, req)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 305, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\operations\prepare.py", line 134, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\req\req_install.py", line 211, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index.py", line 1200, in find_requirement
candidates = self.find_candidates(
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index.py", line 1183, in find_candidates
candidates = self.find_all_candidates(project_name)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index.py", line 1128, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index.py", line 1282, in _get_pages
page = _get_html_page(location, session=self.session)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index.py", line 234, in _get_html_page
resp = _get_html_response(url, session=session)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index.py", line 165, in _get_html_response
resp = session.get(
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\download.py", line 624, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\adapters.py", line 412, in send
conn = self.get_connection(request.url, proxies)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\adapters.py", line 309, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\adapters.py", line 193, in proxy_manager_for
manager = self.proxy_manager[proxy] = proxy_from_url(
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\urllib3\poolmanager.py", line 455, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\urllib3\poolmanager.py", line 406, in __init__
raise ProxySchemeUnknown(proxy.scheme)
pip._vendor.urllib3.exceptions.ProxySchemeUnknown: Not supported proxy scheme None
原因:设置代理的格式错误,前面需要加上http://
解决:
C:\windows\system32>set http_proxy=http://10.xxx.xxx.xxx:xxxx
C:\windows\system32>set https_proxy=http://10.xxx.xxx.xxx:xxxx
C:\windows\system32>pip --trusted-host=pypi.org --trusted-host=files.pythonhosted.org install requests --user
Collecting requests
Downloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
|████████████████████████████████| 61kB 261kB/s
...