这里写目录标题
- 1.检查当前python版本
- 2.下载最新的python
- 3. pip安装
- 4.系统默认python调整
- 5 .错误
1.检查当前python版本
python -v
2.下载最新的python
python下载地址:
wget https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tar.xz
- 进行解压
tar -xvf Python-3.12.2.tar.xz
- 系统更新并安装依赖包
yum update -y
yum install -y make gcc gcc-c++
- 进行编译
cd Python-3.12.2
./configure
- 进行安装
make
make install
- 将原来的python的软连接重命名:
mv /usr/bin/python /usr/bin/python.bak
- 添加软链
ln -s /data/tool/Python-3.12.2/python /usr/bin/python
3. pip安装
wget https://bootstrap.pypa.io/get-pip.py
4.系统默认python调整
- 修改为python2.7
vim /usr/bin/yum
#!/usr/bin/python2.7
5 .错误
- 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
安装 openssl-1.1.1
下载openssl1.1.1wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz --no-check-certificate
解压
tar -zxf openssl-1.1.1n.tar.gz
进入目录
cd openssl-1.1.1n
设置安装目录 可以自定义 但是要记住,后面会用到
./config --prefix=/data/software/openssl
编译并安装
make -j && make install cd /data/package/Python-3.11.5
make clean
./configure --prefix=/data/software/python3 --with-openssl=/data/software/openssl --with-openssl-rpath=auto
make -j && make install