如何在Windows上安装Python ssl模块? [英] How to install Python ssl module on Windows?

查看:1990
本文介绍了如何在Windows上安装Python ssl模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google App Engine启动器告诉我:


警告appengine_rpc.py:399 ssl模块未找到。
如果没有ssl模块,则无法验证远程主机的身份,并且
连接可能不安全。要解决此问题,请安装
的ssl模块 http://pypi.python.org/pypi / ssl


我下载了软件包,它包含一个 setup.py 文件。我跑了:

  python setup.py install 

然后:

  Python是用Visual Studio 2003构建的; blablabla使用MinGW32 

然后我安装了MinGW32,现在编译不起作用。编译错误的结尾包含:


ssl / _ssl2.c:1561:错误:`CRYPTO_LOCK'未声明(首次在此函数中使用)

错误:命令'gcc'失败,退出状态1


我应该怎么做?

解决方案

抓住 openssl libgw32c 软件包gnuwin32项目(下载开发者文件!),并将它们解压到你安装gnuwin32的地方 - 或者如果你还没有gnuwin32工具,你可以将它解压到任何地方(例如C:\ Program Files \gnuwin32)。在setup.py文件中输入gnuwin32目录(替换154行中的C:\Utils\GnuWin32)。

然后你可以建立 ssl 模块没有问题。我自己测试了它,使用GCC4.3.2-tdm-2 mingw32和命令行 setup.py build -cmingw32 -cmingw32 强制MinGW,因为我也安装了Microsoft的编译器)。在成功构建安装 ssl 后执行 setup.py install


The Google App Engine Launcher tells me:

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 .

I downloaded the package and it contained a setup.py file. I ran:

python setup.py install

and then:

Python was built with Visual Studio 2003; blablabla use MinGW32

Then I installed MinGW32 and now the compilation doesn't work. The end of the compilation errors contains:

ssl/_ssl2.c:1561: error: `CRYPTO_LOCK' undeclared (first use in this function)

error: command 'gcc' failed with exit status 1

What should I do?

解决方案

Grab the openssl and libgw32c packages from the gnuwin32 project (download the "Developer files"!) and extract them where you installed gnuwin32 - or if you don't have gnuwin32 tools yet, you can extract it anywhere (e.g. "C:\Program Files\gnuwin32"). Enter the gnuwin32 directory in the "setup.py" file (replace "C:\Utils\GnuWin32" in line 154).

Then you can build the ssl module without problems. I tested it myself, using GCC "4.3.2-tdm-2 mingw32" and with the command line setup.py build -cmingw32 (-cmingw32 forces MinGW as I also have Microsoft's compiler installed). Execute setup.py install after the successful build to install ssl.

这篇关于如何在Windows上安装Python ssl模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆