谷歌应用引擎启动程序告诉我:
WARNING appengine_rpc.py:399 ssl module not found. Without the ssl module, the identity of the remote host cannot be verified, and connections may NOT be secure. To fix this, please install the ssl module from http://pypi.python.org/pypi/ssl .
我下载了这个包,它包含一个setup.py
文件。我跑了:
python setup.py install
然后:
Python was built with Visual Studio 2003; blablabla use MinGW32
然后我安装了MinGW32,现在编译不起作用了。编译错误的结尾包含:
ssl/_ssl2.c:1561: error: `CRYPTO_LOCK' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1
我该怎么办?
我使用了AndiDog和Saxon-Druce的答案,这些答案100%正确,但对于像我这样缺乏经验的用户,可能需要澄清:
这仅适用于Windows用户。
安装Python2.5.2 32位-这对我很重要,因为我有x64系统,我第一次安装了Python2.5.2x64,而建议的解决方案根本不适合我,所以它是32位的。
安装GCC-http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/tdm-gcc-4.5.2.exe/download,我使用的是最新版本,安装时不要忘记选择add to PATH变量选项,否则您必须自己将GCC bin文件夹的路径添加到环境变量“PATH”中。
运行
python setup.py build -cmingw32
(最简单的方法是启动cmd并导航到提取ssl库的目录)-这将编译ssl库运行
python setup.py install --skip-build
安装它应该可以。
我真的很惊讶,他们这么多年没能把ssl库添加到app engine sdk或python安装程序中,可能是人们不使用它。
从gnuwin32项目中获取openssl和libgw32c包(下载“开发人员文件”!)并在安装gnuwin32的地方提取它们-或者如果您还没有gnuwin32工具,您可以在任何地方提取它(例如“C:\ Program Files\gnuwin32”)。在“setup.py”文件中输入gnuwin32目录(替换第154行中的“C:\ Utils\gnuwin32”)。
然后您就可以毫无问题地构建
ssl
模块。我自己测试过它,使用GCC“4.3.2-tdm-2 mingw32”,并使用命令行setup.py build -cmingw32
(-cmingw32
强制MinGW,因为我还安装了微软的编译器)。在成功构建后执行setup.py install
以安装ssl
。我不得不对AndiDog的方法进行以下修改:
如果没有--skip build选项,安装程序将尝试重新生成并再次抱怨MSVC:
另外,最初使用build命令时,我有很多错误,比如:
这是因为我最初安装了64位版本的Python2.5.4(Python-2.5.4.amd64.msi)。我删除了它并安装了32位版本(python-2.5.4.msi)。这包括libpython25.a文件,build命令正在查找该文件。
相关问题 更多 >
编程相关推荐