win10代理上网远程开发python pip安装软件包
代码:
C:\windows\system32>set http_proxy=10.xxx.xxx.xxx:xxxxC:\windows\system32>set https_proxy=10.xxx.xxx.xxx:xxxxC:\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 mainstatus = self.run(options, args)File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py", line 345, in runresolver.resolve(requirement_set)File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolveself._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_oneabstract_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_forabstract_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_requirementreq.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_linkself.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_requirementcandidates = self.find_candidates(File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index.py", line 1183, in find_candidatescandidates = 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_candidatesfor 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_pagespage = _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_pageresp = _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_responseresp = session.get(File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\sessions.py", line 546, in getreturn self.request('GET', url, **kwargs)File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\download.py", line 624, in requestreturn 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 requestresp = 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 sendr = adapter.send(request, **kwargs)File "c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\requests\adapters.py", line 412, in sendconn = 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_connectionproxy_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_formanager = 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_urlreturn 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:xxxxC:\windows\system32>set https_proxy=http://10.xxx.xxx.xxx:xxxxC:\windows\system32>pip --trusted-host=pypi.org --trusted-host=files.pythonhosted.org install requests --user
Collecting requestsDownloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)|████████████████████████████████| 61kB 261kB/s
...