pip升级后的PyOpenSSl版本0.13.1 [英] PyOpenSSl version 0.13.1 after pip upgrade

查看:734
本文介绍了pip升级后的PyOpenSSl版本0.13.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac El Capitan上.我的系统显示我卡在PyOpenSSl版本0.13.1上.当我升级到16.2.0时,升级成功.但是,当我检查版本时,它仍然是0.13.1.为什么会这样?

I am on Mac El Capitan. My system shows me stuck on PyOpenSSl version 0.13.1. When I upgrade to 16.2.0, the upgrade is successful. However, when I check the version, it's still on 0.13.1. Why is this?

MacBook-Air:include$ sudo pip install pyopenssl --user --upgrade
Password:
The directory '/Users/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pyopenssl
  Downloading pyOpenSSL-16.2.0-py2.py3-none-any.whl (43kB)
    100% |████████████████████████████████| 51kB 1.1MB/s
Requirement already up-to-date: cryptography>=1.3.4 in /Library/Python/2.7/site-packages (from pyopenssl)
Collecting six>=1.5.2 (from pyopenssl)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already up-to-date: cffi>=1.4.1 in /Library/Python/2.7/site-packages (from cryptography>=1.3.4->pyopenssl)
Requirement already up-to-date: pyasn1>=0.1.8 in /Library/Python/2.7/site-packages (from cryptography>=1.3.4->pyopenssl)
Collecting setuptools>=11.3 (from cryptography>=1.3.4->pyopenssl)
  Downloading setuptools-32.3.1-py2.py3-none-any.whl (479kB)
    100% |████████████████████████████████| 481kB 1.3MB/s
Requirement already up-to-date: idna>=2.0 in /Library/Python/2.7/site-packages (from cryptography>=1.3.4->pyopenssl)
Requirement already up-to-date: ipaddress in /Library/Python/2.7/site-packages (from cryptography>=1.3.4->pyopenssl)
Requirement already up-to-date: enum34 in /Library/Python/2.7/site-packages (from cryptography>=1.3.4->pyopenssl)
Requirement already up-to-date: pycparser in /Library/Python/2.7/site-packages (from cffi>=1.4.1->cryptography>=1.3.4->pyopenssl)
Installing collected packages: six, pyopenssl, setuptools

然后检查版本,这是错误的版本:

And then checking the version, it's the wrong one:

Successfully installed pyopenssl-16.2.0 setuptools-32.3.1 six-1.10.0
MacBook-Air:include$ pip show pyopenssl
Name: pyOpenSSL
Version: 0.13.1
Summary: Python wrapper module around the OpenSSL library
Home-page: http://pyopenssl.sourceforge.net/
Author: Jean-Paul Calderone
Author-email: exarkun@twistedmatrix.com
License: APL2
Location: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requires:

推荐答案

问题的核心是sudo pip install pyopenssl --user --upgrade正在安装到未首先显示"non-sudo" pip ...的目录中.发生这种情况的原因有很多.

The core of the problem is that sudo pip install pyopenssl --user --upgrade was installing into a directory where the "non-sudo" pip ... did not look first. There are many reasons why that might happen.

简化此问题的第一个方面是理解pip install --user ...永远不需要与sudo一起运行. --user选项意味着安装到用户软件包目录中(应该位于/Users/your_username/下的某个位置),并且不需要高级特权.

The first aspect to simplify this problem is understanding that pip install --user ... should never need to be run with sudo. The --user option means install into the user packages directory (it should be under /Users/your_username/ somewhere), and advanced privileges are not needed for that.

如果不使用sudo尝试pip install --user --upgrade pyopenssl,它应该可以解决问题.

If you try pip install --user --upgrade pyopenssl without sudo, it should solve the problem.

旧的pyopenssl-0.13.1仍将存在于/System/Library/Frameworks/Python.framework/Versions/2.7/...中,但是新的pyopenssl-0.13.1现在应存在于/Users/your_username/...中,并且应该首先由Python导入机制找到.

The old pyopenssl-0.13.1 will still exist in /System/Library/Frameworks/Python.framework/Versions/2.7/... , however the new one should now exist in /Users/your_username/... and should be found first by the Python import machinery.

但是,很有可能pip install --user将新版本的pyopenssl安装在Python导入机制不可见的目录中. 要解决此问题,您需要知道pip要将软件包安装在何处.如果默认的pip输出没有告诉您正在安装软件包,请尝试使用pip install --user --verbose ... 然后,您需要将此路径添加到PYTHONPATH,例如以下内容,其中...替换为pip安装软件包的位置(应该在/Users/your_username/下的某个位置).

However, there is a reasonable chance that pip install --user is installing the new version of pyopenssl in a directory where the Python import machinery doesnt look. To fix this, you need to know where pip is installing the package. Try using pip install --user --verbose .. if the default pip output it doesnt tell you were the package is being installed. Then you need to add this path to PYTHONPATH, such as the following with ... replaced with where pip installed the package (it should be under /Users/your_username/ somewhere).

export PYTHONPATH="/Users/your_username/Library/...:$PYTHONPATH"
pip show pyopenssl

如果可行,请将上面的export ..添加到bash .profile中,以便Python运行时始终从该目录中首先加载软件包.

If that works, add the above export .. to your bash .profile so that your Python runtime is always loading packages from that directory first.

这篇关于pip升级后的PyOpenSSl版本0.13.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆