服务环境:centos7 安装Python3.10.4最新稳定版,以下为安装过程 *** 作。
Python各个版本路径:
python所有版本https://www.python.org/ftp/python/
Python3.10.4下各版本
https://www.python.org/ftp/python/3.10.4/https://www.python.org/ftp/python/3.10.4/
下载python最新稳定版
wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz
安装依赖环境
yum -y groupinstall "Development tools"
yum install -y ncurses-devel gdbm-devel xz-devel sqlite-devel tk-devel uuid-devel readline-devel bzip2-devel libffi-devel
yum install -y openssl-devel openssl11 openssl11-devel #删除
解压文件,并进入安装目录
tar -zxvf Python-3.10.4.tgz
cd Python-3.10.4
编译安装
./configure --enable-optimizations && make altinstall
验证安装结果
/usr/local/bin/python3.10 --version
/usr/local/bin/pip3.10 --version
官方的pip源无法访问,以下错误显示,需要手动配置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(SSLCertVerificationError(1,
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer
certificate (_ssl.c:997)')))
新建pip配置文件
mkdir -p ~/.pip
touch ~/.pip/pip.conf
编辑配置文件如下
vim ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
extra-index-url=
http://pypi.douban.com/simple/
http://mirrors.aliyun.com/pypi/simple/
#proxy = [user:passwd@]proxy.server:port
[install]
trusted-host=
pypi.tuna.tsinghua.edu.cn
pypi.douban.com
mirrors.aliyun.com
ssl_verify: false
以上配置了清华,豆瓣,阿里云源,并且关闭了ssl验证。当然如果有需要还可以设置代理,把注释掉的proxy那行放开即可。
再验证一下
pip3 install --upgrade pip
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)