pip升级后的PyOpenSSl版本0.13.1

pip升级后的PyOpenSSl版本0.13.1,openssl,pip,osx-elcapitan,pyopenssl,Openssl,Pip,Osx Elcapitan,Pyopenssl,我在麦卡皮坦。我的系统显示我被PyOpenSSl版本0.13.1卡住了。当我升级到16.2.0时,升级成功。但是,当我检查版本时,它仍然在0.13.1上。为什么会这样 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

我在麦卡皮坦。我的系统显示我被PyOpenSSl版本0.13.1卡住了。当我升级到16.2.0时,升级成功。但是,当我检查版本时,它仍然在0.13.1上。为什么会这样

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
然后检查版本,它是错误的:

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…
并没有首先查看该目录。这可能有很多原因

简化此问题的第一个方面是理解
pip install--user…
永远不需要使用
sudo
运行。
--user
选项意味着安装到user packages目录中(它应该在
/Users/your_username/
的某个地方),并且不需要高级权限

如果您尝试在不使用sudo的情况下
pip安装--user--upgrade pyopenssl
,应该可以解决问题

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

然而,
pip install--user
很有可能正在Python导入机制看起来不正常的目录中安装新版本的pyopenssl。 要解决此问题,您需要知道
pip
在哪里安装软件包。尝试使用
pip安装--user--verbose..
如果默认的pip输出没有告诉您正在安装包。 然后,您需要将此路径添加到
PYTHONPATH
,例如下面的
..
替换为安装包的
pip
位置(它应该位于
/Users/your_username/
的某个位置)


如果这样做有效,请将上面的
export..
添加到bash
.profile
中,以便Python运行时总是首先从该目录加载包。

,,,等等…感谢您的建议。我已尝试创建正确的符号链接,但仍有问题。我有以下链接:staff 44 Jan 16 01:11 openssl->/usr/local/ceral/openssl/1.0.2j/bin/openssl。然而,“哪个openssl”会产生“openssl 0.9.8zh 2016年1月14日”,而不是1.0.2j版本。知道为什么吗?
export PYTHONPATH="/Users/your_username/Library/...:$PYTHONPATH"
pip show pyopenssl