centos7 python3.5 下安装paramiko

centos7 python3.5 下安装paramiko

安装开发包

yum install openssl openssl-devel python-dev -y

安装pip前需要前置安装setuptools

wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26

tar -zxvf setuptools-19.6.tar.gz

cd setuptools-19.6

python3 setup.py build

python3 setup.py install

报错: RuntimeError: Compression requires the (missing) zlib module

我们需要在linux中安装zlib-devel包,进行支持。

需要对python3.5进行重新编译安装。

cd python3.5

make & make install

又是漫长的编译安装过程。

重新安装setuptools

python3 setup.py build

python3 setup.py install

2、安装pip

wget --no-check-certificate  https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb

tar -zxvf pip-8.0.2.tar.gz

cd pip-8.0.2

python3 setup.py build

python3 setup.py install

安装pycrypto

 $ tar -zxvf pycrypto-2.0.1.tar.gz

 $ cd pycrypto-2.0.1

 $ python setup.py build

 $ sudo python setup.py install

安装paramiko

 $ tar -zxvf paramiko-1.7.6.tar.gz

 $ cd paramiko-1.7.6

 $ python setup.py build

 $ sudo python setup.py install

运行报错

root@localhost Python-3.5.2]# python
Python 3.5.2 (default, Jul 22 2016, 20:52:21) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/site-packages/paramiko-2.0.2-py3.5.egg/paramiko/__init__.py", line 30, in <module>
  File "/usr/local/lib/python3.5/site-packages/paramiko-2.0.2-py3.5.egg/paramiko/transport.py", line 32, in <module>
ImportError: No module named 'cryptography'

解决方案

pip3 install cryptography
posted @ 2016-09-16 22:02  Dus  阅读(1320)  评论(0编辑  收藏  举报