解决pip is configured with locations that require TLS/SSL问题

2023-05-16

python3.7安装, 解决pip is configured with locations that require TLS/SSL问题
1.安装相关依赖

yum install gcc libffi-devel zlib* openssl-devel libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y


2.下载并解压
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
# 下载
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
# 解压并编译:
tar -xvJf Python-3.7.1.tar.xz
cd Python-3.7.1

3.编译安装
./configure prefix=/usr/local/python3
make && make install
# 编译完成后,创建软链接文件到执行文件路径:
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
# 我们可以清除之前编译的可执行文件及配置文件 && 清除所有生成的文件:
make clean && make distclean

bug: 使用pip 命令失败
2.1 错误信息
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting virtualenv
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/virtualenv/
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/virtualenv/
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/virtualenv/
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/virtualenv/
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/virtualenv/
Could not fetch URL https://pypi.org/simple/virtualenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/virtualenv/ (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 virtualenv (from versions: )
No matching distribution found for virtualenv
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

2.2 原因
系统版本centos6.5,其中openssl的版本为OpenSSL 1.0.1e-fips 11 Feb 2013,而python3.7需要的openssl的版本为1.0.2或者1.1.x,需要对openssl进行升级,并重新编译python3.7.0。yum 安装的openssl 版本都比较低。

2.3 升级openssl
# 1.下贼openssl
wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz
tar -zxvf openssl-1.1.1a.tar.gz
cd openssl-1.1.1a
# 2.编译安装
./config --prefix=/usr/local/openssl no-zlib #不需要zlib
make
make install
# 3.备份原配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl/ /usr/include/openssl.bak
# 4.新版配置
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
# 5.修改系统配置
## 写入openssl库文件的搜索路径
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
## 使修改后的/etc/ld.so.conf生效
ldconfig -v
# 6.查看openssl版本
openssl version

openssl version 提示:

/usr/local/openssl/bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

假如你的libssl.so.1.1 文件在/usr/local/openssl/lib/下面,可以这样做

ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1

ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

 

3.3 重新安装python
./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
make
make install

 


导出Python环境安装包
[root@bogon ~]# pip freeze > packages.txt
这将会创建一个 packages.txt文件,其中包含了当前环境中所有包及各自的版本的简单列表(即pip list 所列出的包列表)
安装导入Python环境包
[root@bogon ~]# pip install -r packages.txt

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

解决pip is configured with locations that require TLS/SSL问题 的相关文章

  • pip install django_compressor 时命令 cl.exe 失败

    我发布此消息是因为我遇到了这个问题 并且已经尝试解决这个问题好几天了 但未能成功 当我尝试安装 django compressor pip install django compressor 时 我遇到以下错误 请参阅附件 我在网上搜索解决
  • Pip 无法在 Windows 上安装 Twisted

    我正在尝试在 Windows 8 计算机上安装 Twisted 在 Twisted 官方网站上 只有一个 Windows 版的 Wheel 文件 https twistedmatrix com trac wiki Downloads htt
  • pip:需要将包名称tensorflow-gpu更改为tensorflow

    我正在尝试将具有 GPU 支持的张量流安装到 conda 环境中 我使用命令 pip install ignore installed upgrade https storage googleapis com tensorflow linu
  • pip 列出活动 virtualenv 中的全局包

    将 pip 从 1 4 x 升级到 1 5 后pip freeze输出我的全局安装 系统 软件包的列表 而不是我的 virtualenv 中安装的软件包的列表 我尝试再次降级到 1 4 但这并不能解决我的问题 这有点类似于这个问题 http
  • 如何在Windows中的Python 3.9下pip安装pickle?

    我需要pickle https docs python org 3 9 library pickle html module pickle包安装在我的下面Python 3 9在 Windows 10 下 我尝试过的 当尝试与pip inst
  • gitlab-ci 的缓存虚拟环境

    我使用 Gitlab CI 脚本缓存了 Pip 包 所以这不是问题 现在我还想赶上Conda虚拟环境 因为它减少了设置环境的时间 我缓存了一个虚拟环境 不幸的是 最后需要很长时间才能缓存所有 venv 文件 我尝试仅缓存 CI PROJEC
  • 如何使用 Poetry 从现有项目导入requirements.txt

    我正在尝试Poetry https python poetry org 在现有项目中 它最初使用 pyenv 和 virtualenv 所以我有一个requirements txt包含项目依赖项的文件 我想导入requirements tx
  • pip 中的“在安装记录中找不到 .egg-info 目录”是什么意思?

    自从更新了最新的setuptools 6 0 1 我收到警告 黄色 Could not find egg info directory in install record for 对于我更新的所有软件包 例如 当更新 Twisted 时 我
  • pip 是否将软件包安装到我的 conda 环境中?

    如果我使用 conda create 命令创建了一个环境 那么我激活它 conda activate myEnv 现在 如果我想将带有 conda install 的包安装到 myEnv 但该包不在 conda 存储库中 所以我必须使用 p
  • 如何并行安装/编译 pip 要求(使 -j 等效)

    我的 pip 要求中有很多软件包需要安装 我想并行处理它们 我知道 例如 如果我想要n并行作业来自make我必须写make j n 是否有满足 pip 要求的等效命令 Thanks 有时 pip 使用 make 来构建依赖项 如果在开始之前
  • 在 virtualenvwrapper 中激活环境

    我安装了virtualenv and virtualenvwrapper用这个命令我创建了一个环境 mkvirtualenv cv 它有效 创建后我就处于新环境中 现在我重新启动了我的电脑 我想activate又是那个环境 但是怎么样 我使
  • 如何从 Dockerfile 安装 Python 3.7 和 Pip

    我正在尝试构建基于 Ubuntu 18 04 的自定义 Docker 映像 Ubuntu 预装了 Python 3 6 但我想 1 安装 Python 3 7 2 将其设置为默认 Python 版本 这样就可以使用python代替pytho
  • 如何在 Windows 上使用 Python 3.6 来安装 Python 2.7

    我想问一下如何使用pip install对于 Python 2 7 当我之前安装并使用 Python 3 6 时 我现在必须使用 Windows 上的 Python 版本 pip install 继续安装 Python 3 6 我需要使用以
  • 命令“pip list”显示错误

    我想做 python 但我什至无法配置它 D 所以我在 Linux Mint 上安装了 pip 当输入 pip list 时出现错误 Exception Traceback most recent call last File usr li
  • 在 Databricks 集群上 pip-install 来自 Azure Artefact 的 Python 包

    我有一个小型演示包 已将其发布到 Azure Devops 我可以通过启动虚拟环境并将特定的全局设置添加到我的本地环境中来进行 pip 安装 pip conf file 现在 我想将其安装到我的 databricks 集群中 我无法找到任何
  • 无法通过 pip 安装 xmlsec

    我在运行时收到以下信息pip install xmlsec在 macOS Big Sur 11 3 1 中 Building wheels for collected packages xmlsec Building wheel for x
  • 无法在 VS Code 中导入

    我是 python 新手 一直在使用 VS code 现在我正在研究汤普森采样问题 需要 numpy 和 matplotlib 我已经导入了这两个库 但 VS code 给出了无法导入的错误 我知道我必须使用 PIP 进行安装 并且我已经看
  • PyCharm venv 失败:“没有这样的选项:--build-dir”

    我正在新的 Windows 10 笔记本电脑上进行全新安装 我安装了Python 3 9和PyCharm Community 2020 2 然后开始了一个新项目 在项目设置中 我在 venv 文件夹内的 venv 中创建了一个新的项目解释器
  • 在哪里可以找到“get-pip.py”下载链接?

    作为教程的一部分 我尝试下载 pip py 但链接现在不同了 我找不到可以下载 pip 的按钮 这是我得到的链接 https pip pypa io en stable installing cmdoption no setuptools
  • 无法安装 psycopg2 (pip install psycopg2)

    我使用的是 MAC 和 python 版本 2 7 14 Collecting psycopg2 Could not fetch URL https pypi python org simple psycopg2 There was a p

随机推荐