Install dependencies First
Yum-y Install GCC
1 Installing Pycrypto
wget http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gztar-xf PYCRYPTO-2.6.TAR.GZCD pycrypto-2.6/ Python setup.py build && python setup.py install
Test, pay attention to case
Python>> Import Crypto
2 Installing Paramiko
wget https://pypi.python.org/packages/2b/27/b64860e7b208ff1dd36fe208d07bca1f9637a11fe733e2f2ceea587c3f75/ Paramiko-1.7.5.zipunzip paramiko-1.7.5.zipcd paramiko-1.7.5python setup.py build && python setup.py install
Test:
Python>> Import Paramiko
Error
/usr/lib64/python2.6/site-packages/crypto/util/randpool.py:40:randompool_deprecationwarning:this Application Uses Randompool, which is broken in older releases. See Http://www.pycrypto.org/randpool-broken
randompool_deprecationwarning)
Open the file and drop the two lines of code:
vim/usr/lib64/python2.6/site-packages/crypto/util/randpool.py
Re-authentication is done by
Python>> Import Paramiko
Telnet
Import paramiko# bind client ssh = Paramiko. Sshclient () Ssh.set_missing_host_key_policy (Paramiko. Autoaddpolicy ()) Ssh.connect ("10.10.10.62", "The Root", "888888") stdin, stdout, stderr = Ssh.exec_command ("/sbin/ Ifconfig ") print Stdout.readlines () ssh.close ()
Transferred from: http://www.cnblogs.com/taiguyiba/p/6051022.html
Python Learning note--paramiko module installation and use (RPM)