工作上要将客户端生成的zip包通过ssh上传到指定的服务器上, 每次都登录终端是相当烦的。作为程序员【相同的操作超过三次就考虑写成脚本】的想法。就将这一些操作写成脚本。这里使用python 2.7来脚本化。
在python上使用ssh就使用paramiko模块,由于依赖关系一共要安装pyCrypto,ecdsa, paramiko
1、安装pyCrypto
http://www.voidspace.org.uk/python/modules.shtml#pycrypto
下载合适的包, 我这里下载 pycrypto-2.6.win-amd64-py2.7.exe
失败,提示:
Python version 2.7 required, which was not found in the registry
这表明,注册表表上没有python 2.7 的样子,自己修改有点麻烦 。这里引用一个python脚本的方法。
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valen