我有一个 Kali Linux 发行版,它是 amd64 上的 Kali GNU/Linux Rolling(当前版本 2017.3)。我会定期更新它,并且没有干预系统文件或包管理。然而,不久前 python2 和 OpenSSL 不再一起玩了。一开始这很奇怪,但现在它是一个大麻烦。例如,像这样的简单调用失败:
# pip
/usr/lib/python2.7/dist-packages/cffi/model.py:532: UserWarning: 'point_conversion_form_t' has no values explicitly defined; guessing that it is equivalent to 'unsigned int'
% self._get_c_name())
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 64, in <module>
vendored("cachecontrol")
File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 4, in <module>
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/__init__.py", line 52, in <module>
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/packages/__init__.py", line 59, in <module>
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/packages/__init__.py", line 32, in vendored
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 47, in <module>
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 112, in <module>
if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'FFILibrary' object has no attribute 'Cryptography_HAS_SSL_ST'
仔细筛选各种搜索引擎结果,我发现这似乎是一个已知的不兼容问题,但显然没有切实的干净解决方案。令我困惑的是,在积极维护的发行版中怎么会发生这种情况?(其实,同样设置的同事没有这个问题。)
有没有一种简单的方法可以在不重新安装整个发行版的情况下修复/修复这个问题?
安装的版本是 python/kali-rolling 2.7.14-1、python-openssl/kali-rolling 16.2.0-1 和 python-cffi/kali-rolling 1.9.1-2。
我假设您已经
pip
从分发存储库安装?如果是这样,只需删除当前版本并使用get-pip.py
pip
安装它:这应该会提取所有适当的依赖项,您
pip
将重新开始工作。里面的东西
/usr/lib/python2.7/dist-packages
是罪魁祸首——多亏了 strace。删除它解决了这个问题。经验教训:对需要非标准包的程序使用虚拟环境。