Linux centos 解决WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
时间: 2024-01-22 22:16:41 浏览: 214
在Linux CentOS系统中解决"WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available."的问题,可以尝试以下方法:
1. 安装openssl-devel包:
```shell
sudo yum install openssl-devel
```
2. 更新pip:
```shell
pip install --upgrade pip
```
3. 重新安装Python:
```shell
# 下载Python源码包
wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
# 解压源码包
tar -zxvf Python-3.9.7.tgz
# 进入解压后的目录
cd Python-3.9.7
# 配置安装路径
./configure --prefix=/usr/local/python3
# 编译并安装
make && sudo make install
# 创建软链接
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3
```
4. 配置环境变量:
```shell
echo 'export PATH=/usr/local/python3/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
```
请注意,以上方法是在CentOS系统下进行的,对于Deepin系统(基于Ubuntu/Debian的发行版),可以尝试以下方法:
1. 安装openssl-devel包:
```shell
sudo apt-get install libssl-dev
```
2. 更新pip:
```shell
pip install --upgrade pip
```
3. 重新安装Python:
```shell
# 下载Python源码包
wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
# 解压源码包
tar -zxvf Python-3.9.7.tgz
# 进入解压后的目录
cd Python-3.9.7
# 配置安装路径
./configure --prefix=/usr/local/python3
# 编译并安装
make && sudo make install
# 创建软链接
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3
```
4. 配置环境变量:
```shell
echo 'export PATH=/usr/local/python3/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
```
阅读全文