在 Windows 上安装 paramiko
这听起来像是在 SF 上重复出现的问题,但我还找不到明确的答案。所以。 我使用“setup.py install”命令安装了 Paramiko 1.7,在运行 demo.py 程序时,我收到此错误:
Traceback (most recent call last):
File "C:\Documents and Settings\fixavier\Desktop\paramiko-1.7\demos\demo.py", line 33, in <module>
import paramiko
File "C:\Python26\lib\site-packages\paramiko\__init__.py", line 69, in <module>
from transport import randpool, SecurityOptions, Transport
File "C:\Python26\lib\site-packages\paramiko\transport.py", line 32, in <module>
from paramiko import util
File "C:\Python26\lib\site-packages\paramiko\util.py", line 31, in <module>
from paramiko.common import *
File "C:\Python26\lib\site-packages\paramiko\common.py", line 99, in <module>
from Crypto.Util.randpool import PersistentRandomPool, RandomPool
ImportError: No module named Crypto.Util.randpool
即使在安装 PyCrypto 2.1 后,我仍收到此错误。 在运行 test.py(随安装一起提供)时,我收到以下错误 -
Traceback (most recent call last):
File "C:\Documents and Settings\fixavier\Desktop\pycrypto-2.0.1\pycrypto-2.0.1\test.py", line 18, in <module>
from Crypto.Util import test
File "C:\Documents and Settings\fixavier\Desktop\pycrypto-2.0.1\pycrypto-2.0.1\build/lib.win32-2.6\Crypto\Util\test.py", line 17, in <module>
import testdata
File "C:\Documents and Settings\fixavier\Desktop\pycrypto-2.0.1\pycrypto-2.0.1\test\testdata.py", line 450, in <module>
from Crypto.Cipher import AES
ImportError: cannot import name AES
在这一切之后我没有信心继续安装 AES,据我所知,我可能会收到另一个 ImportError! 请指教,是不是安装方式有问题?
This may sound like a repeated question on SF, but I could not find a clear answer to it, yet.So.
I installed Paramiko 1.7 with "setup.py install" command and while running the demo.py program, I got this error:
Traceback (most recent call last):
File "C:\Documents and Settings\fixavier\Desktop\paramiko-1.7\demos\demo.py", line 33, in <module>
import paramiko
File "C:\Python26\lib\site-packages\paramiko\__init__.py", line 69, in <module>
from transport import randpool, SecurityOptions, Transport
File "C:\Python26\lib\site-packages\paramiko\transport.py", line 32, in <module>
from paramiko import util
File "C:\Python26\lib\site-packages\paramiko\util.py", line 31, in <module>
from paramiko.common import *
File "C:\Python26\lib\site-packages\paramiko\common.py", line 99, in <module>
from Crypto.Util.randpool import PersistentRandomPool, RandomPool
ImportError: No module named Crypto.Util.randpool
I'm getting this error even after installing PyCrypto 2.1.
On running test.py(which comes with the installation), I got the following error -
Traceback (most recent call last):
File "C:\Documents and Settings\fixavier\Desktop\pycrypto-2.0.1\pycrypto-2.0.1\test.py", line 18, in <module>
from Crypto.Util import test
File "C:\Documents and Settings\fixavier\Desktop\pycrypto-2.0.1\pycrypto-2.0.1\build/lib.win32-2.6\Crypto\Util\test.py", line 17, in <module>
import testdata
File "C:\Documents and Settings\fixavier\Desktop\pycrypto-2.0.1\pycrypto-2.0.1\test\testdata.py", line 450, in <module>
from Crypto.Cipher import AES
ImportError: cannot import name AES
I don't have the confidence to go ahead and install AES after all this, for all I know I may get another ImportError!
Please advice.Is it the way of installation thats problematic?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
看起来您的 pycrypto 安装已损坏或未安装。
尝试在此处获取 python2.6 安装程序的 pycrypto,并在安装后重试。
Looks like your pycrypto installation is broken or not installed.
Try to get a pycrypto for python2.6 installer here and try again after installing it.
我尝试了Vijay的方法,但不起作用。
我在“http://kmdarshan.com/blog/?p=3208”上使用该方法,它有效:
Goto to http://twistedmatrix.com/trac/wiki/Downloads并下载适用于windows/python2.5的pycrypto包.exe。这是运行 paramiko 所必需的。
接下来,从 http://www.lag.net/paramiko/ 下载 paramiko 软件包.
将paramiko解压到临时文件夹,最好解压到python安装的文件夹。
将
进入paramiko的文件夹。
打开命令提示符并确保已将 python 设置为环境变量。
运行这个命令 python setup.py install
你会得到一系列的编译行。只要确保它们没有任何错误即可。如果有任何错误,您将需要重新编译它们。
请确保一切正常,在您的程序中导入 paramiko 并查看。
仅供参考:paramiko 用于 ssh.. 等。
I tried Vijay's method,but it doesn't work.
I use the method on 'http://kmdarshan.com/blog/?p=3208',it works:
Goto to http://twistedmatrix.com/trac/wiki/Downloads and download the pycrypto package .exe for windows/python2.5. This is needed for running paramiko.
Next, download the paramiko package from http://www.lag.net/paramiko/.
Unzip paramiko to a temporary folder, better if you unzip it to the folder where python is installed.
Go into the folder for paramiko.
Open command prompt and see to it that you have python set as the environment variable.
Run this command python setup.py install
You will get a series of lines of compilation. Just make sure you dont have any error in them. If you have any errors you will need to re compile them again.
Just be be sure everything is alright import paramiko in your program and see.
FYI: paramiko is used for ssh..and so on.
下载 Windows 版 paramiko。您将获得 zip 文件:
www.lag.net/paramiko/
要构建它,您需要依赖包 pycrypto。再次记住,您将需要一个与您的 Python 相匹配的 pycrypto 版本。这是 Windows 的内置版本,因此无需安装。 http://www.voidspace.org.uk/python/modules.shtml#pycrypto
您可以通过下载 setuptools 来进行 easy_install,但我遇到了一些问题,所以我选择下载 MinGW 工具。这又是一个安装,不需要构建。 http:// sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/
一旦你在 Windows 计算机上安装了 pycrypto 和 MinGW,只需浏览到从 zip 文件中提取 paramiko 模块的文件夹并发出以下命令:
python setup.py build --compiler=mingw32 bdist_wininst
TADA!您已准备好在 Windows 计算机上使用 Python 来使用 ssh。
Download paramiko for windows. You get the zip file:
www.lag.net/paramiko/
To build it you need the dependency package pycrypto. Again keep in mind you will need a matching version of pycrypto for your Python. This is a built version of Windows so no install is required. http://www.voidspace.org.uk/python/modules.shtml#pycrypto
You could do an easy_install by downloading setuptools but I ran into some issues so I chose to download MinGW tool. This is again an installation and no build is required. http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/
Once you have pycrypto and MinGW installed on your windows machine, just browse to the folder where you extracted the paramiko module from the zip file and issue this command:
python setup.py build --compiler=mingw32 bdist_wininst
TADA! You are all set to use ssh on your windows machine with Python.
我已成功将 paramiko 安装到 64 位 Windows 7 上:
“python setup.py安装”
I have installed paramiko onto 64bit Windows 7 successfully:
"python setup.py install"
我想在 Windows XP 上安装适用于 Python 3.3.2 的 Paramiko。 我按照此处的说明进行操作
下载列表中的所有程序后, 对于我的 Python 版本,Paramiko 启动没有问题。
I wanted to install Paramiko for Python 3.3.2 on Windows XP. I followed the instructions here
After I downloaded all programs on the list for my Python version, Paramiko starts without problems.
实际的问题似乎不是加密安装损坏,而是略有不同。在 Windows 上使用 easy_install 安装 paramiko 和 crypto 后,我确实安装了 crypto 但没有安装 Crypto。我安装了 PyCrypt 包(它给出了一个错误,因为在安装 Visual Studio Express 之前我没有 C 编译器)
The actual problem does not seem to be a broken Crypto install but a slightly different one. After installing paramiko and crypto with easy_install on windows I do have crypto installed but not Crypto. I installed the package PyCrypt (which gave an error because I didn't have a C compiler before I installed visual studio express)
您下载的加密包似乎没有 AES...
您应该尝试执行以下操作:
如果其中任何一个失败,那么您仍然需要确保安装 pycrypto(请参阅 S.Mark 此处),否则 Paramiko 可能不依赖于 AES(即使有测试为此)
It appears that the Crypto package you downloaded doesn't have AES...
you should try doing the following:
if any of those fail then you still need to make sure pycrypto is installed (see the link from S.Mark here), otherwise Paramiko might not depend on having AES (even though there is a test for that)
PyCrypto 似乎使用了 c 编译器(Linux 系统中固有的 - gcc)。
另外,PyCrypto readme.txt 文件中的某处说,在进行“安装”之前需要先“构建”
在 Linux 上,我首先构建它,然后在其上运行“安装”命令并成功安装。
It seems PyCrypto uses a c-compiler(which is inherently present on the Linux system - gcc).
Also, somewhere on the PyCrypto readme.txt file says, it needs to be 'build' first, before doing an 'install'
On Linux, I build it first and then ran 'install' command on it and was successfully installed.
我搜索了很长时间寻找这个问题的解决方案。我正在运行 Windows 7 64 位和 python 2.7。上述解决方案都不适合我。
这个做到了
下载 Microsoft SDK 时不要忘记包含 C++ 编译器,默认情况下没有选中它。
我下载了 pycrypto 2.5 源代码进行编译,并下载了 paramiko 2.3,一切运行良好。
I searched for a long time looking for a solution to this problem. I'm running Windows 7 64-bit and python 2.7. None of the above solutions worked for me.
this one did
Don't forget to include the C++ compiler when you download the Microsoft SDK, it wasn't checked by default.
I downloaded the pycrypto 2.5 source to do the compile and the paramiko 2.3, things work well.
这是一个非常精确的答案:
第 1 步:转到 https://github.com/paramiko/paramiko< /a>
第 2 步:下载 zip 文件并解压
第 3 步:进入文件夹并运行 python setup.py install
您就完成了!
Here is a very precise answer:
Step 1: Go to https://github.com/paramiko/paramiko
Step 2: Download the zip file, and extract it
Step 3: Move into the folder and run python setup.py install
You are done!
我在我的 mac 上也遇到了类似的问题,我解决这个问题的方法是将“crypto”目录重命名为“Crypto”。我已经安装了 paramiko 和 ssh。他们现在都工作得很好。然而,这对于某些人来说可能有效,也可能无效,但这只是解决这个问题的一个简单想法。
I had the similar problem on my mac and the way I solved it was by simply just renaming the "crypto" directory to the "Crypto". I already had the paramiko and ssh installed in it. They both work perfectly fine now. However, this may or may not work for some one but this is just a simple thought on getting the ways around this problem.
请尝试,然后
如果显示错误,
just try
if this shows error, then