Linux下安装Python

一、部署 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
  1. 其他源地址

阿里云 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值