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

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

问题描述

Google App Engine Launcher 告诉我:

The Google App Engine Launcher tells me:

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

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 文件.我跑了:

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

python setup.py install

然后:

Python was built with Visual Studio 2003; blablabla use MinGW32

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

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

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

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

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

error: command 'gcc' failed with exit status 1

我该怎么办?

推荐答案

抓住 openssllibgw32c 来自 gnuwin32 项目的包(下载开发者文件"!)并解压它们在您安装 gnuwin32 的位置 - 或者如果您还没有 gnuwin32 工具,您可以将其解压缩到任何位置(例如C:Program Filesgnuwin32").进入setup.py"文件中的gnuwin32目录(替换第154行的C:UtilsGnuWin32")

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 Filesgnuwin32"). Enter the gnuwin32 directory in the "setup.py" file (replace "C:UtilsGnuWin32" in line 154).

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

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天全站免登陆