笔记-python-centos环境下安装配置
笔记-python-centos环境下安装配置
1. 准备工作
- 环境准备
centos6.5 mini,已有python 2.6.6
- 下载源码包
Python官网下载Gzipped source tarball(版本3.6.5)
tar –xvf ……
- 安装环境
mkdir /usr/local/python3.6.5
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
- 开始安装
./configure
报错no acceptable C compiler found
安装gcc编译器 yum -y install gcc
- 编译安装
./configure –prefix=/usr/local/python3.6.5
make && make install
- 添加环境变量
vi ~/.bash_profile
修改下面一行
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
使环境变量生效
source ~/.bash_profile
建立软链接
ln -s /usr/local/python3.6.5/bin/python3.6 /usr/bin/python3
- 验证
python3 –V
pip3 -V
日拱一卒无有尽,功不唐捐终入海