python - 由于 SSL,使用 easy)install 安装 pip 和其他库失败

标签 python pip nose easy-install

尝试在我新擦过的 MacBookPro 上获取 pip 和其他一些实用程序。

尝试运行 Distribution_setup.py 失败,出现 403:SSL required;关于某些依赖项:

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

找到了一个应该有效的解决方法,但在其他依赖项上也失败了:(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.

最佳答案

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

这可以通过 Brew 轻松实现:

酿造 ( https://brew.sh )

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

Python 3.x

brew install python --reinstall 这将安装/重新安装 Python 3.6.x

Python 2.7.x

brew 安装 python@2

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

关于python - 由于 SSL,使用 easy)install 安装 pip 和其他库失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49835849/

相关文章:

python - 不能 "activate"virtualenv

python - 测试安装的 Python 包

python - 在所有子目录中运行 nosetests

python - 给定一个点和大量的四面体,如何高效判断该点在哪个四面体中

python - 如何将 argparse 参数传递给另一个 python 程序?

python - 平铺图像需要很长时间

python - 将python测试运行信息导入sonarqube

python - 如何用Python下载网页上的PDF文件

python - 使用 pip 在 Windows 中安装 ZeroMQ/pyzmq 时遇到问题

python - Numpy 安装 AWS EC2 报错