centos7安装python3.6.5

安装python3.6可能使用相关软件

# yum groupinstall 'Development Tools'
# yum install -y ncurses-libs zlib-devel mysql-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

安装python3.6.5

python官网下载https://www.python.org

下载的安装包存放在/usr/local目录

# cd /usr/local

# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz

解压:

# tar -xf Python-3.6.5.tar.xz

解压后新建文件夹将Python-3.6.5放在/usr/local/python3下

进入该目录····························一定要进去的哈,不然安装会出错

# mkdir python3
# mv Python-3.6.5 python3
# cd python3/Python-3.6.5

执行如下代码安装

···························--prefix选项是配置安装的路径,执行后所有资源文件放在/usr/local/python3.6的路径中

# ./configure --prefix=/usr/local/python3
# make
# make install

创建软连接

# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

最后测试版本

# python3 -V
# pip3 -V

 

posted @ 2019-06-14 09:33  菜鸟程序猿_python  阅读(329)  评论(0编辑  收藏  举报