首先;
um -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y
下载Python3
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
安装python3
mkdir -p /usr/local/python3
解压编译安装
-
tar -zxvf Python-3.7.0.tgz -
cd Python-3.7.0 -
./configure --prefix=/usr/local/python3 -
make && make install
建立python3的软链
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
将/usr/local/python3/bin加入PATH
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
linux python3换pip 源
1)检查pip.conf文件是否存在
>> cd ~
>> mkdir .pip
>> ls ~/.pip
2)直接编辑pip.conf
sudo vim ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

pip国内的一些镜像
阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
本文详细介绍了在Linux环境下从源码编译安装Python3的方法,包括必要的依赖包安装、Python源码下载、配置、编译及安装步骤。此外,还提供了修改pip源至国内镜像的教程,以提高下载速度。
2092

被折叠的 条评论
为什么被折叠?



