Python 在 Windows 上安装 paramiko

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20538685/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 20:41:36  来源:igfitidea点击:

Install paramiko on Windows

pythonpipparamikoeasy-installpycrypto

提问by tmporaries

OK. I read installing paramiko on Windows.

好的。我阅读了在 Windows 上安装 paramiko

All mentioned methods simply do not work.

所有提到的方法根本不起作用。

Authors have different environments with different components/libraries installed. Or may be they don't test their solutions before posting an answer :)

作者有不同的环境,安装了不同的组件/库。或者他们可能在发布答案之前没有测试他们的解决方案:)

I removed all python versions and libs from my machine (Windows 8 x64) and tried to install python and paramiko from scratch.

我从我的机器(Windows 8 x64)中删除了所有 python 版本和库,并尝试从头开始安装 python 和 paramiko。

Method number 1 (FAILED)

方法 1(失败)

  1. Install python-2.7.3.amd64.msi
  2. Install pycrypto-2.6.win-amd64-py2.7.exe
  3. Download https://github.com/paramiko/paramiko/archive/master.zip, unpack it.
  4. Run setup.py install
  5. Go to IDLE, run import paramiko.
  1. 安装 python-2.7.3.amd64.msi
  2. 安装 pycrypto-2.6.win-amd64-py2.7.exe
  3. 下载https://github.com/paramiko/paramiko/archive/master.zip,解压。
  4. 运行 setup.py 安装
  5. 转到 IDLE,运行 import paramiko。

Result:

结果:

Traceback (most recent call last):   File "<pyshell#0>", line 1, in
<module>
  import paramiko   File "C:\Python27\lib\site-packages\paramiko\__init__.py", line 65, in
<module>
    from transport import SecurityOptions, Transport   File "C:\Python27\lib\site-packages\paramiko\transport.py", line 45, in
<module>
   from paramiko.ecdsakey import ECDSAKey   File "C:\Python27\lib\site-packages\paramiko\ecdsakey.py", line 24, in
<module>
  from ecdsa import SigningKey, VerifyingKey, der, curves ImportError: No module named ecdsa

Method number 2 (FAILED)

方法 2(失败)

  1. Install python-2.7.3.amd64.msi
  2. Install setuptools-1.4.2.win-amd64-py2.7.exe
  3. Install pip-1.4.1.win-amd64-py2.7.exe
  4. pip install paramiko
  5. Go to IDLE, run import paramiko.
  1. 安装 python-2.7.3.amd64.msi
  2. 安装 setuptools-1.4.2.win-amd64-py2.7.exe
  3. 安装 pip-1.4.1.win-amd64-py2.7.exe
  4. pip 安装 paramiko
  5. 转到 IDLE,运行 import paramiko。

Result:

结果:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import paramiko
  File "C:\Python27\lib\site-packages\paramiko\__init__.py", line 64, in <module>
    from transport import SecurityOptions, Transport
  File "C:\Python27\lib\site-packages\paramiko\transport.py", line 33, in <module>
    from paramiko import util
  File "C:\Python27\lib\site-packages\paramiko\util.py", line 33, in <module>
    from paramiko.common import *
  File "C:\Python27\lib\site-packages\paramiko\common.py", line 98, in <module>
    from Crypto import Random
ImportError: No module named Crypto

Method number 3 (SUCCESS)

方法 3(成功)

  1. Install python-2.7.3.amd64.msi
  2. Install pycrypto-2.6.win-amd64-py2.7.exe
  3. Install setuptools-1.4.2.win-amd64-py2.7.exe
  4. Install pip-1.4.1.win-amd64-py2.7.exe
  5. Run pip install ecdsa
  6. Download and extract https://github.com/paramiko/paramiko/archive/master.zip
  7. Run setup.py install
  8. Open IDLE, run import paramiko
  1. 安装python-2.7.3.amd64.msi
  2. 安装pycrypto-2.6.win-amd64-py2.7.exe
  3. 安装setuptools-1.4.2.win-amd64-py2.7.exe
  4. 安装pip-1.4.1.win-amd64-py2.7.exe
  5. 运行pip install ecdsa
  6. 下载并解压https://github.com/paramiko/paramiko/archive/master.zip
  7. 运行setup.py 安装
  8. 打开 IDLE,运行import paramiko

Result: no errors

结果:没有错误

Please, help me to find step-by-step algorithm for installing python and paramiko on clean windows 8 machine. Thanx.

请帮助我找到在干净的 Windows 8 机器上安装 python 和 paramiko 的分步算法。谢谢。

UPD: Solution has been found.

UPD:已找到解决方案。

回答by Yuval Adam

You're missing the pycryptodependency. pipis the easiest way:

你缺少pycrypto依赖。pip是最简单的方法:

pip install pycrypto
pip install paramiko

Alternatively, you can install from source, with:

或者,您可以从源代码安装,使用:

easy_install ./

(See: https://github.com/paramiko/paramiko)

(见:https: //github.com/paramiko/paramiko

回答by kallel

  • For the first sequence you need to install 'ecdsa' with pip because paramiko compilation does not automatically resolve its dependencies (as your working solution)

  • The second failed, as stated already, because you did not install pycrypto before running pip install paramiko. I would recommend to use this option rather than installing from source to enable easier upgrade path using pip. Also pip is the easiest to install using their standalone install script: http://pip.readthedocs.org/en/latest/installing.html

  • 对于第一个序列,您需要使用 pip 安装“ecdsa”,因为 paramiko 编译不会自动解决其依赖项(作为您的工作解决方案)

  • 如前所述,第二个失败了,因为您在运行之前没有安装 pycrypto pip install paramiko。我建议使用此选项而不是从源代码安装,以便使用 pip 启用更简单的升级路径。此外 pip 是最容易使用其独立安装脚本安装的:http://pip.readthedocs.org/en/latest/installing.html

回答by Rushi

For installing paramiko, Visual Basic Compiler is needed.

为了安装paramiko,需要Visual Basic Compiler。

First download it from Microcsoft: Microsoft Visual C++ Compiler for Python 2.7

首先从微软下载:Microsoft Visual C++ Compiler for Python 2.7

Open the paramiko directory and run python setup.py install . And it will download dependencies from internet; especially pycrypto and installation will be successful.

打开 paramiko 目录并运行 python setup.py install 。它将从互联网下载依赖项;特别是pycrypto,安装会成功。

回答by Touchstone

For windows users:

对于 Windows 用户:

  1. Install Python 2.7.11
  2. Download and install pycrypto win-amd64-py2.7.exe
  3. Now open a command prompt. If you have installed python at the following location:

    c:\Python27 then change directory and go to Scripts directory.

  4. Now type the following command:

    pip install paramiko

  1. 安装 Python 2.7.11
  2. 下载并安装pycrypto win-amd64-py2.7.exe
  3. 现在打开命令提示符。如果您在以下位置安装了 python:

    c:\Python27 然后更改目录并转到 Scripts 目录。

  4. 现在输入以下命令:

    pip 安装 paramiko

enter image description here

enter image description here

That's it, you have successfully installed Paramiko.

就是这样,您已经成功安装了Paramiko。

回答by SergeySD

Also, I faced with the following errors like:

另外,我遇​​到了以下错误,例如:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27-x86\include -IC:\Python27-x86\PC /Tcbuild\temp.win32-2.7\Release_openssl.c /Fobuild\temp.win32-2.7\Release\build\temp.win32-2.7\Release_openssl.obj

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27-x86\include -IC:\Python27 -x86\PC /Tcbuild\temp.win32-2.7\Release_openssl.c /Fobuild\temp.win32-2.7\Release\build\temp.win32-2.7\Release_openssl.obj

_openssl.c

_openssl.c

build\temp.win32-2.7\Release_openssl.c(423) : fatal error C1083: Cannot open include file: 'openssl/opensslv.h': No such file or directory

build\temp.win32-2.7\Release_openssl.c(423):致命错误 C1083:无法打开包含文件:'openssl/opensslv.h':没有这样的文件或目录

error: command 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe' failed with exit status 2

错误:命令 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe' 失败,退出状态为 2

missed this file: 'openssl/opensslv.h'

错过了这个文件:'openssl/opensslv.h'

it will be happens because while installation paramiko/cryptography/pyOpenSSL packages, they all needed distribution package of OpenSSL-Win32with *.liband headers files like: openssl\opensslv.h

会发生这种情况是因为在安装 paramiko/cryptography/pyOpenSSL 包时,它们都需要带有*.lib和头文件的OpenSSL-Win32分发包,例如:openssl\opensslv.h

so, after installation appropriate OpenSSL app. version, took from here: http://code.x2go.org/releases/binary-win32/3rd-party/Win32OpenSSL/

因此,在安装适当的 OpenSSL 应用程序后。版本,取自这里:http: //code.x2go.org/releases/binary-win32/3rd-party/Win32OpenSSL/

and copied all headers from C:\OpenSSL-Win32\include\openssl*.* to C:\Pyhton27\inclide*.*

并将所有标头从 C:\OpenSSL-Win32\include\openssl*.* 复制到 C:\Pyhton27\inclide*.*

and copied all libs from C:\OpenSSL-win32\lib to C:\Python27\Lib*.*

并将所有库从 C:\OpenSSL-win32\lib 复制到 C:\Python27\Lib*.*

paramiko package was installed successfully. ! I hope it will be helpful somebody.:) good luck:)

paramiko 包安装成功。!我希望它会对某人有所帮助。:) 祝你好运:)