在Windows上为Python (2.5.4)安装SSL模块

4

由于AppEngine要求通过SSL上传您的应用程序,因此我尝试在我的工作笔记本电脑上安装该模块。

我的系统是x64 Win 7,已安装Python 2.5.4 x86。

我按照这篇文章的指南进行了操作:如何在Windows上安装Python ssl模块? 并查看了所有相关链接。

但主要问题是,MinGw和GnuWin似乎都无法正常工作。

GnuWin已完美安装,已更新并具有构建SSL模块所需的所有依赖项。

但在输入命令

> "C:\Python25\python.py" setup.py install -c mingw32

这个命令明显失败了。 "-cmingw32"和"-gnuwin32"也是一样。 (-cmingw32显然失败了,因为尽管MinGW已经完全安装好了,但MinGW没有被识别)

使用"build"而不是"install"似乎会"输出"一些内容: MinGw抱怨"ggc no such file or directory",而在GnuWin中,"it doesn't know how to compile C/C++ on a nt with gnuwin"

对我来说听起来完全是胡言乱语,因为我按照教程中的说明做了一切。

我解决了问题的一部分:现在easy_install可以识别gcc了,但AE仍然抱怨缺少SSL模块,尽管easy_install和python都说Pycrypto incl. SSL已经成功安装

easy_install ssl

C:\Users\faits>easy_install ssl
Searching for ssl
Best match: ssl 1.15
Adding ssl 1.15 to easy-install.pth file

Using c:\python25\lib\site-packages
Processing dependencies for ssl
Finished processing dependencies for ssl

easy_install pycrypto

C:\Users\faits>easy_install ssl
Searching for ssl
Best match: ssl 1.15
Adding ssl 1.15 to easy-install.pth file

Using c:\python25\lib\site-packages
Processing dependencies for ssl
Finished processing dependencies for ssl

python

IDLE 1.2.4      
>>> import ssl

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import ssl
  File "C:\Python25\lib\site-packages\ssl\__init__.py", line 61, in <module>
    import _ssl2             # if we can't import it, let the error propagate
ImportError: No module named _ssl2

python

>>> import pycrypto

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import pycrypto
ImportError: No module named pycrypto

注意:在mingw中编译器应该是gcc而不是ggc - jfs
请将您从 easy_install 获得的命令和精确错误信息粘贴在下方。 - jfs
C:\Users\faits>easy_install ssl 正在搜索 ssl 最佳匹配: ssl 1.15 正在将 ssl 1.15 添加到 easy-install.pth 文件中使用 c:\python25\lib\site-packages 正在处理 ssl 的依赖项 已完成处理 ssl 的依赖项 - Julius F
请确保带有“_ssl2.pyd”文件的目录在您的“%PATH%”中。顺便说一句,这些说明似乎很复杂,我不确定它们是否会产生正确的64位版本。这是一个通用的有用页面(但它没有pycrypto、ssl)http://www.lfd.uci.edu/~gohlke/pythonlibs/。 - jfs
@daemonfire300:如果你想让我收到通知,请在评论开头使用“@J.F. Sebastian:”。 - jfs
2个回答

2

0

使用build命令时,加上-c选项。

对比:

$ python setup.py install -c

--compile (-c)     compile .py to .pyc [default]

使用:

$ python setup.py build -c

--compiler (-c)    specify the compiler type

要查看其他选项,请运行:

$ python setup.py build --help


我使用了build -c(例如--compiler=gnuwin),但它不知道如何编译。 - Julius F

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接