如何在MacOS Sierra(10.x)上完全删除并重新安装PIP?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在MacOS Sierra(10.x)上完全删除并重新安装PIP?相关的知识,希望对你有一定的参考价值。
让PIP正常工作直到几天前。不确定如何。
试着现在运行它,现在显示问题。添加错误的完整堆栈:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 487, in _prepare_file
req_to_install, finder)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 428, in _check_skip_installed
req_to_install, upgrade_allowed)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 683, in _get_page
return htmlPage.get_page(link, session=self.session)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 390, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 290, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 194, in proxy_manager_for
**proxy_kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py", line 367, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py", line 312, in __init__
proxy = parse_url(proxy_url)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py", line 189, in parse_url
raise LocationParseError(url)
LocationParseError: Failed to parse: user:pass
想要尝试完全重新安装pip。
建议的方法是什么?
下载Anaconda(或Miniconda),运行它,然后重新启动终端然后开始使用环境。创建环境类型
conda create -n my_project_name python=3.6
conda activate my_project_name
现在进行所需的所有pip安装和conda安装。你的路径是固定的。皮普是固定的。疯了。
编辑:现在您已经发布了完整的回溯,看起来您需要向代理提供用户名和密码。这是一种方法。
pip install --proxy=https://user@mydomain:port somepackage
你的pip
和Python安装都很好。你的代理配置有什么问题。
在OS X上,环境变量和OS X网络配置都可以提供代理信息。首先找出你的配置:
python2.7 -c 'import urllib, pprint; pprint.pprint(urllib.getproxies())'
然后在网络设置中查找任何不正确的配置(在系统配置中,检查代理选项卡的活动网络),并在*_proxy
条目的环境变量中查找(http_proxy
,https_proxy
等)。
您可以通过使用--proxy
开关在命令行上设置代理来手动覆盖代理:
pip --proxy= install ...
注意空的--proxy=
;或者您可以设置特定的代理。
如果你真的需要重新安装你的Python设置,你似乎已经安装了自己的Homebrew,所以你可以用brew install -f python@2
重新安装它。
以上是关于如何在MacOS Sierra(10.x)上完全删除并重新安装PIP?的主要内容,如果未能解决你的问题,请参考以下文章
如何以编程方式在 macOS Sierra/High Sierra 上创建 PPTP *** 连接?
官方方法MacBook2017 双系统恢复macOS High Sierra
[黑苹果]:如何在Virtualbox上安装macOS Sierra?