我正在运行centos 6.10的专用服务器上安装Python 3.7
在跳了几圈试图做到这一点之后,我又犯了一个错误。使用Python3.7来尝试保持最新,pip安装中出现SSL问题是一个相当常见的问题。我得出的结论是,解决这个问题的最佳方法是获得正确版本的OpenSSL。所以我这样做了,编辑我的python modules/Setup.dist文件,重新配置它,重新运行make altinstall,尽管一切看起来都很好。出于某种原因,我以前运行这个python时使用的命令Python3.7突然变成了一个无法识别的命令,而Python3.7目录中有一个文件夹python,在执行时(在编辑环境路径后)该文件夹打开了Python3.7。以前不是这样,只是Python3.7有人知道这里可能发生了什么吗?
而且,我对整个SSL的事情几乎是束手无策了,我读到了《太阳底下》的每一篇文章。以下是我最近执行的一些命令的列表:#Unpacked Python3.7 into /usr/src directory
./configure --enable-optimizations --enable-loadable-sqlite-extensions
make altinstall
#installation failed from no '_ctypes' module
yum install libffi-devel
#repeat configure above
#yaaay python
#Successfully installed pip-10.0.1 setuptools-39.0.1 was the final message of the installation
Python3.7 -m venv /my/project/directory/ENV
pip install {library}
#this is where my issues began with SSL
日志:(ENV) [root@s1.1.1.1 ProjectDirectory]# pip3 install twisted
pip is configured with locations that require TLS/SSL, however, the SSL module in Python is not available.
Collecting twisted
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/twisted/
Could not fetch URL https://pypi.org/simple/twisted/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/twisted/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement twisted (from versions: )
No matching distribution found for twisted
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSLmodule is not available.")) - skipping
所以我觉得很酷。别担心。最新版本的Python甚至不能让pip3立即发布。精彩的。好吧,我开始像我们一样搜索谷歌,得出的结论是,每个人都只是重新配置他们的python,它神奇地工作了。不知道为什么,但可以。我很喜欢。我发现这篇文章:
想得很酷。如果我能得到python3.7ssl,那么它应该能让pip3正常工作?错了。不幸的是,如果我用上面提到的新的奇怪方式启动Python3.7,并键入import ssl,就会得到这个错误:Traceback (most recent call last):
File "", line 1, in
File "/usr/src/Python-3.7.0/Lib/ssl.py", line 98, in
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
有人能帮我吗?我有点迷失在海洋里,我不知道怎么游泳。。。任何事情都会很棒,但我是一个服务器管理员的东西,所以越简单越好:)提前谢谢。
编辑:
顺便说一句yum install openssl
以及yum install openssl-devel
两者都会导致“已安装”标志。。。所以我不认为这是另一个解决办法。然而,当我手动安装时,我使用了版本1.1.1,因为我知道3.7出于任何原因放弃了对几个不同版本OpenSSL的支持。我认为已经安装了百胜的是1.0.2。我不知道centos 6.10平台是否有足够的容量,尽管版本有限制。