一、部署 Python 3
1、部署编译环境
方式一
yum -y groupinstall 'Development Tools'
yum -y install zlib zlib-devel libffi-devel openssl-devel
方式二、
yum -y install yum-utils
yum-builddep python
2、 Python 官网下载最新版 Python 源代码。
1、进到要下载python的目录
cd /tmp
2、下载
curl -O https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
3、解压
tar xf Python-3.8.0.tgz
3、Python 配置
./Python-3.8.0/configure
4、构建并安装 Python 3
make install Python-3.8.0
5、设置python3为默认版本
查看安装的位置
whereis python3.8
1、 编辑用户自定义配置,输入alias参数
vi /etc/profile.d/python.sh
2、在python.sh输入python3.8的路径
alias python='/usr/local/bin/python3.8'
3、 重启会话使配置生效
source /etc/profile.d/python.sh
6、确认 Python 3 部署成功
python3 --version
7、安装pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py -i https://pypi.tuna.tsinghua.edu.cn/simple/
查看pip版本信息
pip -V
8、 安装自动化依赖 Python 相关库(可以使用阿里云的资源下载)
pip3 install selenium
pip3 install ddt
pip3 install htmlreport
pip3 list
- 其他源地址
阿里云 http://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/
使用方法:
在使用pip的时候在后面加上-i参数,指定pip源
pip install tensorflow_gpu==1.12.0 -i https://pypi.tuna.tsinghua.edu.cn/simple