在Windows上安装适用于Python的SSL模块(2.5.4)

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

它是安装了Python 2.5.4 x86的x64 Win 7系统.

我遵循了这样的指南:How to install Python ssl module on Windows?
以及所有相关链接.

但主要的问题是,MinGw和GnuWin似乎都没有真正起作用.

GnuWin是完美安装的,是最新的,并且具有构建SSL模块所需的所有依赖项.

但输入

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

刚刚失败了.
“-cmingw32”和“-gnuwin32”也是如此.
(-cmingw32显然失败了,因为即使MinGW完全安装,MinGw也没有被认可)

“build”而不是install似乎“输出”了一些东西:
MinGw抱怨“ggc没有这样的文件或目录”,并且使用GnuWin“它不知道如何使用gnuwin在nt上编译C/C++”

这对我来说听起来像是垃圾,因为我按照教程中的描述做了一切.

我解决了我的问题的一部分:gcc现在被easy_install识别,但是AE仍然抱怨缺少SSL模块,尽管easy_install和python都说Pycrypto包括. 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

最佳答案 使用-c和build命令.

相比:

$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

点赞