Paramiko steps in Windows environment python3.5 installation

Source: Internet
Author: User
Recently due to some demand, to engage in http://www.php.cn/wiki/1514.html "target=" _blank ">python, so the weekend engaged. To connect to the server, do some server operations, So install this Paramiko package, directly

Pip Install Paramiko

As a result, the most critical sentence for an error is:

Error:unable to find Vcvarsall.bat

Google lap. Finally find the easiest way to do it. Other installations vs. installing the MinGW are too complicated. Install Pycrypto third-party version because Paramiko relies on Pycrypto, the above error is his error. Install Pycrypto Third-party edition

Pip Install--use-wheel--no-index--find-links=https://github.com/sfbahr/pycrypto-wheels/raw/master/ PYCRYPTO-2.6.1-CP35-NONE-WIN_AMD64.WHL Pycrypto


Once the installation is complete, install Paramiko again. 2. Modify nt.py Install finish the above steps, write a simple program test under

#-*-coding:utf-8-*-#!/usr/bin/python Import paramikoimport threadingdef ssh2 (ip,username,passwd,cmd):    try:        ssh = Paramiko. Sshclient ()        ssh.set_missing_host_key_policy (Paramiko. Autoaddpolicy ())        Ssh.connect (ip,22,username,passwd,timeout=5)        for M in cmd:            stdin, stdout, stderr = Ssh.exec_command (m) Out            = Stdout.readlines ()            #屏幕输出 for O in out            :                print (o)        print ('%s\tok\n '% (IP ))        ssh.close ()    except:        print ('%s\terror\n '% (IP)) if name== ' main ':    cmd = [' Find/home/admin/logs /-mtime +3-name \ ' *.log.*\ '-exec rm-rf {} \; '] #你要执行的命令列表    username = "Admin"  #用户名    passwd = "password"    #密码    threads = []   #多线程    IP = " 127.0.0.1 "    print (" Begin ... ")    a=threading. Thread (target=ssh2,args= (ip,username,passwd,cmd))    A.start ()     input ()

Run an error.

Importerror:no module named ' Winrandom '


Locate the installation directory for python3.5.

Lib\site-packages\crypto\random\osrng

The nt.py file will

Import Winrandom

Change into

From. Import Winrandom

Run OK again. Very simple

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.