首页 > 代码库 > centos7 安装python3.6 及模块安装演示

centos7 安装python3.6 及模块安装演示

目录:

  • 下载python3.6
  • 安装python3.6的依赖
  • 编译安装
  • 更改链接
  • 更改yum脚本的python依赖
  • 修改gnome-weaktool配置文件
  • 修改urlgrabber配置文件

1、下载python3.6

# wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

2、安装python3.6的依赖

# yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

3、编译安装

# tar -xzvf Python-3.6.0.tgz -C  /tmp

# cd  /tmp/Python-3.6.0/

# ./configure --prefix=/usr/local --enable-optimizations

# make

# make altinstall

4、更改链接

# cd /usr/bin

# mv  python python.backup

# ln -s /usr/local/bin/python3.6 /usr/bin/python

# ln -s /usr/local/bin/python3.6 /usr/bin/python3

5、更改yum脚本的python依赖

# cd /usr/bin

# ls yum*

yum yum-config-manager yum-debug-restore yum-groups-manager

yum-builddep yum-debug-dump yumdownloader

更改以上文件头为
#!/usr/bin/python 改为 #!/usr/bin/python2

6、修改gnome-weaktool配置文件

 vi /usr/bin/gnome-tweak-tool

#!/usr/bin/python 改为 #!/usr/bin/python2

 

7、修改urlgrabber配置文件

# vi /usr/libexec/urlgrabber-ext-down

#!/usr/bin/python 改为 #!/usr/bin/python2

centos7 安装python3.6 及模块安装演示