使用easy)安装pip和其他lib会由于SSL而失败

[英]installing pip and other libs using easy)install fails due to SSL


Trying to get pip and some other utils on my newly wiped MacBookPro.

试着在我新擦的MacBookPro上得到pip和其他一些utils。

Trying to run distribute_setup.py fails with 403:SSL required; on some dependencies:

试图distribute_setup运行。py以403失败:需要SSL;在一些依赖关系:

DNS-hosting:~ User1$ sudo python distribute_setup.py
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
Traceback (most recent call last):
  File "distribute_setup.py", line 485, in <module>
    main(sys.argv[1:])
  File "distribute_setup.py", line 480, in main
    tarball = download_setuptools()
  File "distribute_setup.py", line 193, in download_setuptools
    src = urlopen(url)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: SSL is required

Found a workaround that supposed to work, but also fails on other dependencies: (nose/tornado; which I'm also unable to install)

找到一个可以工作的变通方法,但是在其他依赖项上也会失败:(nose/tornado;我也无法安装)

DNS-hosting:~ User1$ sudo curl https://bootstrap.pypa.io/get-pip.py | python
Password:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1622k  100 1622k    0     0  1071k      0  0:00:01  0:00:01 --:--:-- 1071k
Requirement already up-to-date: pip in /var/folders/r7/80znqn9d7jv6qf1wfbxcd_kw0000gn/T/tmpKFvgml/pip.zip (10.0.0)
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.

2 个解决方案

#1


1  

Your timing is good, because pip v10.0.0 was released today.

您的时机很好,因为pip v10.0.0今天发布。

Get the wheel:

得到:

wget https://pypi.python.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl#md5=be3e30acf78a44cd750bf2db0912c701

Use the wheel to install the wheel:

使用车轮安装车轮:

python pip-10.0.0-py2.py3-none-any.whl/pip install pip-10.0.0-py2.py3-none-any.whl

#2


1  

I recommend you maintain a separate installation of Python, so you're not using the system installation and potentially mucking up your dependencies.

我建议您维护一个单独的Python安装,这样您就不会使用系统安装,并且可能会破坏您的依赖性。

This can be easily achieved with Brew:

这可以通过Brew实现:

Brew (https://brew.sh)

Install: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装:/usr/bin/ruby -e“$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Python 3.x

brew install python --reinstall which will install/reinstall Python 3.6.x

brew install python——reinstall,其中将安装/reinstall python 3.6.x

Python 2.7.x

brew install python@2

酿造安装python@2

If you're set on using the local system version, you should be able to reinstall via: sudo easy_install pip

如果您设置使用本地系统版本,您应该能够通过:sudo easy_install pip重新安装


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2018/04/14/8490f36677ef37c057d11dfd22ed9d3a.html



 
© 2014-2018 ITdaan.com 粤ICP备14056181号