gpt4 book ai didi

python-3.x - python 3.6.10 pip3 TLS/SSL 未配置

转载 作者:行者123 更新时间:2023-12-04 22:41:22 25 4
gpt4 key购买 nike

我是 Python 的初学者,并且正在发生一些问题。这是安装 python 3.6.10 的脚本:

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install zlib1g-dev
apt-get install -y libxml2-dev libxslt1-dev libffi-dev libssl-dev
apt-get install -y libgdal-dev
apt-get install -y tor
apt-get install -y unzip
apt-get install -y s3cmd
apt-get install -y libfreetype6-dev
apt-get install -y pkg-config
apt-get install -y qt5-default
apt-get install -y libqt5webkit5-dev
apt-get install -y texinfo
apt-get install -qy firefox xvfb
apt-get install -y tree
apt-get install -y htop
apt-get install -y chromium-browser

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

cd /opt
sudo wget https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tgz

sudo tar -xvf Python-3.6.10.tgz

cd Python-3.6.10
sudo ./configure --with-ssl


sudo make
sudo make install


sudo apt-get install -y build-essential python-pip python3-pip git
sudo -H pip install --upgrade pip
sudo -H pip3 install --upgrade pip



安装似乎工作正常,除了 pip3。发生错误,我没有找到解决方案。
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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/
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 SSL module is not available.",)) - skipping
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages (18.1)
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 SSL module is not available.",)) - skipping


我该如何解决?为什么会这样?

最佳答案

首先:您的 Python 版本应该允许您使用 python3 -m pip作为您的pip命令。 -m标志是 good practice anyway因为它将确保您关联 pip您使用正确的 Python 解释器。所以,python-pip python3-pip不需要安装。*

其次:关于 SSL 选项,您可能需要 python-openssl .具有讽刺意味的是,当我尝试在 packages.ubuntu.com 上搜索此内容时遇到服务器端错误,但它显示在 this up to date example 中旁边 libssl-dev .

Here是一个 Dockerfile,展示了上述两 pip :

docker image build -f Dockerfile.60814903 -t so60814903:1 .
docker container run -it --rm so60814903:1

在那个 shell 中,你应该看到你有 python3 -m pip可用的。

最后一个提示,考虑一个可以帮助您管理多个 Python 版本的解决方案。 pyenv就是这样一种工具,而且还有其他工具。

具体来说, ./configure默认使用 --with-ensurepip='upgrade' . Here是使用 --with-ensurepip=no 的安装示例并单独安装 pip。

关于python-3.x - python 3.6.10 pip3 TLS/SSL 未配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60814903/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com