在 GoDaddy VPS CentOs 7 上安装新的 Python 3.7.1。尝试 pip3 install virtualenv 或 python 3 -m pip install virtualenv 并获取:
pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用。
已安装 openssl-devel 并且是最新的
这个问题已被多次询问和回答,但我找到的解决方案并没有解决我的问题。谢谢你们!
我尝试了以下基于 CentOs 和 Linux 的解决方案:
使用 pip3 安装软件包时“Python 中的 SSL 模块不可用” # 允许构建 python ssl 库 yum install openssl-devel # 下载 任何 python 版本的源代码 cd /usr/src wget https://www.python.org /ftp/python/3.7.1/Python-3.7.1.tar.xz tar xf Python-3.7.1.tar.xz cd Python-3.7.1
# Configure the build w/ your installed libraries
./configure
# Install into /usr/local/bin/python3.6, don't overwrite global python bin
make altinstall
尝试使用 Python 3.7.2 pip 安装包会导致 TSL/SSL 错误
使用 pip3 安装包时出现“Python 中的 SSL 模块不可用”
pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
“Python 中的 ssl 模块不可用” 并且 pip 无法确认 SSL 证书:SSL 模块不可用
`uncommented suggestions for CentOs
make install failed:
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I. -I./Include -DUSE_SSL -I/include -I/include/openssl -c ./Modules/_ssl.c -o Modules/_ssl.o
./Modules/_ssl.c:74:6: error: #error "libssl is too old and does not support X509_VERIFY_PARAM_set1_host()"
./Modules/_ssl.c: In function ‘_ssl_configure_hostname’:
./Modules/_ssl.c:861: error: implicit declaration of function ‘SSL_get0_param’
./Modules/_ssl.c:861: warning: initialization makes pointer from integer without a cast
./Modules/_ssl.c:863: error: implicit declaration of function ‘X509_VERIFY_PARAM_set1_host’
./Modules/_ssl.c:869: error: implicit declaration of function ‘X509_VERIFY_PARAM_set1_ip’
./Modules/_ssl.c: In function ‘_ssl__SSLContext_impl’:
./Modules/_ssl.c:2988: error: ‘X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS’ undeclared (first use in this function)
./Modules/_ssl.c:2988: error: (Each undeclared identifier is reported only once
./Modules/_ssl.c:2988: error: for each function it appears in.)
./Modules/_ssl.c:3093: error: implicit declaration of function ‘SSL_CTX_get0_param’
./Modules/_ssl.c:3093: warning: assignment makes pointer from integer without a cast
./Modules/_ssl.c:3099: error: implicit declaration of function ‘X509_VERIFY_PARAM_set_hostflags’
./Modules/_ssl.c: In function ‘get_verify_flags’:
./Modules/_ssl.c:3397: warning: assignment makes pointer from integer without a cast
./Modules/_ssl.c: In function ‘set_verify_flags’:
./Modules/_ssl.c:3410: warning: assignment makes pointer from integer without a cast
./Modules/_ssl.c: In function ‘set_host_flags’:
./Modules/_ssl.c:3573: warning: assignment makes pointer from integer without a cast
make: *** [Modules/_ssl.o] Error 1`
https://www.tomordonez.com/pip-install-ssl-module-python-is-not-available.html
原文由 Eric 发布,翻译遵循 CC BY-SA 4.0 许可协议
这是 Python 3.7.9 和 CentOS 7.8.2003 的工作解决方案:
在
/usr/src/Python-3.7.9/Modules/Setup.dist
中,取消注释这 4 行:最后: