在Linux安装Python3

2021-04-09 14:56:27 浏览数 (1)

代码语言:javascript复制
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make zlib zlib-devel libffi-devel -y
代码语言:javascript复制
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz

解压安装包,并cd进去

编译并安装

代码语言:javascript复制
./configure --prefix=/usr/local/python3.7.4
make && make install

将Python执行程序放入/usr/bin/中

代码语言:javascript复制
ln -s /usr/local/python3.7.4/bin/python3.7 /usr/bin/python3.7.4

安装代码依赖的第三方库

更新pip

代码语言:javascript复制
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple

安装依赖的库

代码语言:javascript复制
python3 -m pip install pymysql -i https://pypi.tuna.tsinghua.edu.cn/simple

0 人点赞