Python 3 环境搭建

Python 3.6 安装

# 系统更新
yum -y update

# 安装yum补充程序和插件
yum -y install yum-utils epel-release

# Centos开发工具包
yum -y groupinstall development

# 安装IUS(Inline with Upstream Stable)
# https://ius.io/GettingStarted/
yum -y install https://centos7.iuscommunity.org/ius-release.rpm

# 安装Python3.6.3
yum search python3.6 # 搜索最新python
yum -y install python36u # 安装
python3.6 -V # 检查安装是否成功

#pip安装
yum search pip | grep python36u # 搜索支持的pip
yum -y install python36u-pip # 安装

# python开发库
yum -y install python36u-devel

Python 虚拟环境

mkdir environments
cd environments

# 创建环境
python3.6 -m venv odoo

# 激活环境
source ~/environments/odoo/bin/activate

# 退出环境
deactivate

注:在虚拟环境中,你可以使用命令python来代替python3.6,pip来替换pip3.6。如果在环境外的机器上使用Python 3,则需要专门使用python3.6和pip3.6命令。

There are no comment yet.

HTML tag cannot be used in this comment.