在Windows上为Python(2.5.4)安装SSL模块
因为AppEngine要求通过SSL上传你的应用程序,所以我尝试在我的工作笔记本上安装这个模块。
我的电脑是64位的Windows 7系统,安装了32位的Python 2.5.4。
我按照一些指南来操作,比如这个:如何在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没有这样的文件或目录”,而GnuWin则说“它不知道如何在nt上用gnuwin编译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
2 个回答
我把所有的操作步骤整理得很清楚,大家可以去看看这个链接。http://waqasshabbir.tumblr.com/post/18010535789/ssl-module-for-python-2-5-installation-windows-only
在使用 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