最近我遇到了在 Ubuntu 18.04 上pip3无法正常工作的问题:
:~$ pip3 install jinja2
Traceback (most recent call last):
File "/home/redra/.local/bin/pip3", line 7, in <module>
from pip import main
ModuleNotFoundError: No module named 'pip'
Run Code Online (Sandbox Code Playgroud)
然后我尝试重新安装 pip3,似乎是由于它并面临另一个问题:
:~$ sudo -H python3 get-pip.py
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pip
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/pip/
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/pip/
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/pip/
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/pip/
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/pip/
Run Code Online (Sandbox Code Playgroud)
我猜它卡住了......由于pip3不好,我无法安装openssl,并且由于openssl无法安装新的pip3......似乎是循环(
有什么建议吗?有没有人遇到过同样的问题?
这可能是因为openssl编译 python 时所需的二进制文件不存在,以解决此问题
从以下位置下载 openssl(tar.gz 可以解决问题):https : //www.openssl.org/source/
在文件夹中解压 SSL 源
转到文件夹并运行以下命令来制作 openssl
./configure && make && sudo make install
最后 - 重做 Python 编译(configure、make、make install),观察 ssl 库现在编译成 Python,因为它出现在 Python 编译过程正在寻找的标准位置。
| 归档时间: |
|
| 查看次数: |
5788 次 |
| 最近记录: |