所以我试图将SSL添加到我的pi B +上运行的Web服务器(使用cherrypy)
我确保OpenSSL已安装:
sudo apt-get install openssl
然后我安装了pyOpenSSL与:
sudo apt-get install python-openssl
在两种情况下,它都表示:
openssl is already the newest version.
python-openssl is already the newest version.
因为我已经多次运行了该命令。因此,这似乎很好。
到那时,我在python中执行以下操作:
import OpenSSL
我得到错误。特别:
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenSSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 3, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
ImportError: No module named cryptography.hazmat.bindings.openssl.binding
我这里有兼容性问题吗?这两个最新版本是否彼此不兼容?有人看过吗?
我拥有的版本信息:
% openssl version
OpenSSL 1.0.1e 11 Feb 2013
对于python-openssl我有:
% dpkg -s python-openssl
Package: python-openssl
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 532
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Architecture: armhf
Source: pyopenssl
Version: 0.13-2+rpi1+deb7u1
Depends: python (<< 2.8), python (>= 2.6), python-support (>= 0.90.0), libc6 (>= 2.13-28), libssl1.0.0 (>= 1.0.0)
Suggests: python-openssl-doc, python-openssl-dbg
Description: Python 2 wrapper around the OpenSSL library
High-level wrapper around a subset of the OpenSSL library, includes
.
* SSL.Connection objects, wrapping the methods of Python's portable
sockets
* Callbacks written in Python
* Extensive error-handling mechanism, mirroring OpenSSL's error
codes
.
A lot of the object methods do nothing more than calling a
corresponding function in the OpenSSL library.
Homepage: http://launchpad.net/pyopenssl
在python上使用-v标志时,我得到:
>>> import OpenSSL
import OpenSSL # directory /usr/local/lib/python2.7/dist-packages/OpenSSL
# /usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.pyc matches /usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py
import OpenSSL # precompiled from /usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.pyc
# /usr/local/lib/python2.7/dist-packages/OpenSSL/rand.pyc matches /usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py
import OpenSSL.rand # precompiled from /usr/local/lib/python2.7/dist-packages/OpenSSL/rand.pyc
# /usr/lib/python2.7/functools.pyc matches /usr/lib/python2.7/functools.py
import functools # precompiled from /usr/lib/python2.7/functools.pyc
import _functools # builtin
# /usr/local/lib/python2.7/dist-packages/six.pyc matches /usr/local/lib/python2.7/dist-packages/six.py
import six # precompiled from /usr/local/lib/python2.7/dist-packages/six.pyc
# /usr/lib/python2.7/__future__.pyc matches /usr/lib/python2.7/__future__.py
import __future__ # precompiled from /usr/lib/python2.7/__future__.pyc
import itertools # builtin
import operator # builtin
# /usr/lib/python2.7/StringIO.pyc matches /usr/lib/python2.7/StringIO.py
import StringIO # precompiled from /usr/lib/python2.7/StringIO.pyc
# /usr/local/lib/python2.7/dist-packages/OpenSSL/_util.pyc matches /usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py
import OpenSSL._util # precompiled from /usr/local/lib/python2.7/dist-packages/OpenSSL/_util.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 3, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
ImportError: No module named cryptography.hazmat.bindings.openssl.binding