centos6.9安装python3.6.0和模块
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.9安装python3.6.0和模块相关的知识,希望对你有一定的参考价值。
1、安装依赖包
yum -y install wget zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc gcc++
2、下载python包、解压、编译安装
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz tar -xzvf ./Python-3.6.0.tgz -C /usr/local/src/ cd /usr/local/src/Python-3.6.0/ ./configure --prefix=/usr/local/python make make install
3、更改环境变量并使其生效、验证
vim ~/.bash_profile PATH=$PATH:$HOME/bin # 改为: PATH=$PATH:$HOME/bin:/usr/local/python/bin source ~/.bash_profile python3 -V
4、设置默认python版本
mv /usr/bin/python /usr/bin/python2.6 ln -s /usr/local/python/bin/python3.6 /usr/bin/python
5.核对Python版本
python -V Python 3.6.0 python2.6 -V Python 2.6.6
6、更改yum程序,yum程序要用到python 2.X
vi /usr/bin/yum 将 #!/usr/bin/python 改成 #!/usr/bin/python2.6
7、pip安装模块
pip3 install requests
以上是关于centos6.9安装python3.6.0和模块的主要内容,如果未能解决你的问题,请参考以下文章