RHEL6下安装Python相关的paramiko

最近学习了python,用到paramiko模块了,以下是安装文档(注:yum源原配置省略)注:此文档适用于RedHat 6 或者 CentOS 61、以下是源码包安装方式:参考以下网站:https://www.dlitz.net/software/pycrypto/ 或者 wget https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz -O /tmp/pycrypto-2.6.tar.gzwget -O /tmp/paramiko-1.7.7.1.tar.gzyum remove python-crypto python-paramiko -ycd /tmp && tar zxf /tmp/pycrypto-2.6.tar.gz && cd pycrypto-2.6python setup.py -q build && python setup.py -q install

cd /tmp && tar zxf /tmp/paramiko-1.7.7.1.tar.gzcd paramiko-1.7.7.1 && python setup.py -q build && python setup.py -q installcd /tmp && rm -rf pycrypto-2.6 paramiko-1.7.7.1通过以下方式检查安装结果:包括检查模块版本[root@RHEL601 ~]# pythonPython 2.6.5 (r265:79063, Jul 14 2010, 11:36:23) [GCC 4.4.4 20100630 (Red Hat 4.4.4-10)] on linux2Type “help”, “copyright”, “credits” or “license” for more information.>>> dir (Crypto)Traceback (most recent call last): File “<stdin>”, line 1, in <module>NameError: name ‘Crypto’ is not defined>>> import Crypto>>> dir (Crypto) [‘__all__’, ‘__builtins__’, ‘__doc__’, ‘__file__’, ‘__name__’, ‘__package__’, ‘__path__’, ‘__revision__’, ‘__version__’, ‘version_info’]>>> Crypto.__version__’2.6′>>> import paramiko>>> dir (paramiko)[‘AUTH_FAILED’, ‘AUTH_PARTIALLY_SUCCESSFUL’, ‘AUTH_SUCCESSFUL’, ‘Agent’, ‘AgentKey’, ‘AuthHandler’, ‘AuthenticationException’, ‘AutoAddPolicy’, ‘BadAuthenticationType’, ‘BadHostKeyException’, ‘BaseSFTP’, ‘BufferedFile’, ‘Channel’, ‘ChannelException’, ‘ChannelFile’, ‘DSSKey’, ‘HostKeys’, ‘InteractiveQuery’, ‘Message’, ‘MissingHostKeyPolicy’, ‘OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED’, ‘OPEN_FAILED_CONNECT_FAILED’, ‘OPEN_FAILED_RESOURCE_SHORTAGE’, ‘OPEN_FAILED_UNKNOWN_CHANNEL_TYPE’, ‘OPEN_SUCCEEDED’, ‘PKey’, ‘Packetizer’, ‘PasswordRequiredException’, ‘RSAKey’, ‘RejectPolicy’, ‘SFTP’, ‘SFTPAttributes’, ‘SFTPClient’, ‘SFTPError’, ‘SFTPFile’, ‘SFTPHandle’, ‘SFTPServer’, ‘SFTPServerInterface’, ‘SFTP_BAD_MESSAGE’, ‘SFTP_CONNECTION_LOST’, ‘SFTP_EOF’, ‘SFTP_FAILURE’, ‘SFTP_NO_CONNECTION’, ‘SFTP_NO_SUCH_FILE’, ‘SFTP_OK’, ‘SFTP_OP_UNSUPPORTED’, ‘SFTP_PERMISSION_DENIED’, ‘SSHClient’, ‘SSHConfig’, ‘SSHException’, ‘SecurityOptions’, ‘ServerInterface’, ‘SubsystemHandler’, ‘Transport’, ‘WarningPolicy’, ‘__all__’, ‘__author__’, ‘__builtins__’, ‘__date__’, ‘__doc__’, ‘__file__’, ‘__license__’, ‘__name__’, ‘__package__’, ‘__path__’, ‘__version__’, ‘__version_info__’, ‘agent’, ‘auth_handler’, ‘ber’, ‘buffered_pipe’, ‘channel’, ‘client’, ‘common’, ‘compress’, ‘config’, ‘dsskey’, ‘file’, ‘hostkeys’, ‘kex_gex’, ‘kex_group1’, ‘message’, ‘packet’, ‘pipe’, ‘pkey’, ‘primes’, ‘resource’, ‘rsakey’, ‘server’, ‘sftp’, ‘sftp_attr’, ‘sftp_client’, ‘sftp_file’, ‘sftp_handle’, ‘sftp_server’, ‘sftp_si’, ‘ssh_exception’, ‘sys’, ‘transport’, ‘util’]>>> paramiko.__version__’1.7.7.1 (George)’>>> [root@RHEL601 ~]#以上结果表明安装成功!

2、yum安装方式如下:以下是我的安装方式,只需要安装python-paramiko,python-crypto即可[root@RHEL601 ~]# yum install python-crypto python-paramiko -y Loaded plugins: rhnpluginThis system is not registered with RHN.RHN support will be disabled.Setting up Install ProcessResolving Dependencies–> Running transaction check—> Package python-crypto.i686 0:2.0.1-22.el6 set to be updated—> Package python-paramiko.noarch 0:1.7.5-2.1.el6 set to be updated–> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================Package Arch Version Repository Size=====================================================================================Installing:python-crypto i686 2.0.1-22.el6 Server 156 kpython-paramiko noarch 1.7.5-2.1.el6 Server 728 k

Transaction Summary=====================================================================================Install 2 Package(s)Upgrade 0 Package(s)

Total download size: 884 kInstalled size: 8.1 MDownloading Packages:————————————————————————————-Total 81 MB/s | 884 kB 00:00 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : python-crypto-2.0.1-22.el6.i686 1/2 Installing : python-paramiko-1.7.5-2.1.el6.noarch 2/2

Installed: python-crypto.i686 0:2.0.1-22.el6 python-paramiko.noarch 0:1.7.5-2.1.el6

Complete!import测试如下:[root@RHEL601 ~]# pythonPython 2.6.5 (r265:79063, Jul 14 2010, 11:36:23) [GCC 4.4.4 20100630 (Red Hat 4.4.4-10)] on linux2Type “help”, “copyright”, “credits” or “license” for more information.>>> import paramiko>>> 没有报错,说明paramiko模块已经正确安装,,可以正常使用了,关于该模块的使用方法以后再续写相关文档!

生活不要太劳累,弄得自己很疲惫,快乐幸福多体会,

RHEL6下安装Python相关的paramiko

相关文章:

你感兴趣的文章:

标签云: