欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[Python] 安装与环境配置

程序员文章站 2022-04-12 16:15:03
...

centos 安装python3

必要工具

# yum -y groupinstall "Development tools"
# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel readline readline-devel libffi-devel

下载安装

# wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
# wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz  
# tar -xvf Python-3.7.0.tar.xz
# ./configure --prefix=/usr/local/python3
# make && make install
# ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
# ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
# python3 -V

添加环境变量

# vim ~/.bashrc
export PATH=$PATH:/usr/local/python3/bin/
# source .bashrc

更新pip

# pip3 install --upgrade pip
# pip3 list
Package    Version
---------- -------
pip        20.0.2
setuptools 39.0.1
virtualenv 16.7.9
相关标签: Program python