python在windows安装paramiko模块
生活随笔
收集整理的這篇文章主要介紹了
python在windows安装paramiko模块
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天抽時間倒騰了一下ST,發現當前的ST工程只能在linux下運行,但部門的人都不怎么會使用ST來保障代碼質量。于是就想移植到windows下使用,首先就牽涉到了windows上遠程執行命令及收集執行結果,腳本自動上傳,日志自動下載等功能。這就要使用到ssh服務,所以就學習了一下windows下python的ssh功能的使用。
Python中使用SSH需要用到OpenSSH,而OpenSSH依賴于paramiko模塊,而paramiko模塊又依賴于pycrypto模塊,因此要在Python中使用SSH。所以我們需要先安裝pycrypto工具,然后再安裝paramiko模塊才能使用。
到下面這個網站下載編譯好的pycrypto(自己到官網下載編譯會比較麻煩,也可能過程中會出問題)
http://www.voidspace.org.uk/python/modules.shtml#pycrypto
安裝完成后執行如下則表示安裝成功:
注意大小寫,如果寫成小寫會出錯!!!
C:\Users\wangyuling>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Crypto >>>>>>>>> import cryptoTraceback (most recent call last): File "<stdin>", line 1, in <module>ImportError: No module named crypto>>> 安裝paramiko:https://pypi.python.org/pypi/paramiko/1.7.7.1下載后解壓,然后命令行進入到解壓后的目錄,執行下面命令:python setup.py build
安裝完成后執行如下則表示安裝成功:
E:\python\paramiko-1.7.7.1>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>>
Python中使用SSH需要用到OpenSSH,而OpenSSH依賴于paramiko模塊,而paramiko模塊又依賴于pycrypto模塊,因此要在Python中使用SSH。所以我們需要先安裝pycrypto工具,然后再安裝paramiko模塊才能使用。
首先要確保python安裝好,且環境變量設置好
paramiko模塊的使用請參考另一篇博文:http://blog.csdn.net/wangyuling1234567890/article/details/21656471
到下面這個網站下載編譯好的pycrypto(自己到官網下載編譯會比較麻煩,也可能過程中會出問題)
http://www.voidspace.org.uk/python/modules.shtml#pycrypto
安裝完成后執行如下則表示安裝成功:
注意大小寫,如果寫成小寫會出錯!!!
C:\Users\wangyuling>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Crypto >>>>>>>>> import cryptoTraceback (most recent call last): File "<stdin>", line 1, in <module>ImportError: No module named crypto>>> 安裝paramiko:https://pypi.python.org/pypi/paramiko/1.7.7.1下載后解壓,然后命令行進入到解壓后的目錄,執行下面命令:python setup.py build
python setup.py install
我的環境:
E:\python\paramiko-1.7.7.1>python setup.py build...E:\python\paramiko-1.7.7.1>python setup.py install...安裝完成后執行如下則表示安裝成功:
E:\python\paramiko-1.7.7.1>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>>
paramiko模塊的使用請參考另一篇博文:http://blog.csdn.net/wangyuling1234567890/article/details/21656471
轉載于:https://www.cnblogs.com/lrszs/p/3618479.html
總結
以上是生活随笔為你收集整理的python在windows安装paramiko模块的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Revit二次开发示例:DeleteOb
- 下一篇: cascade