文章标题

1、下载Python安装

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

2、把Python3.6安装到/usr/local/python36 目录

# ./configure --prefix=/usr/local/python36 
# make && make install

更改/usr/bin/python链接

# cd/usr/bin
# mv  python python.backup
# ln -s /usr/local/python36/bin/python3.6 /usr/bin/python
# ln -s  /usr/local/python36/bin/python3.6  /usr/bin/python3(可以不用)

更改yum脚本的python依赖

# cd /usr/bin
# ls yum*
yum yum-config-manager yum-debug-restore yum-groups-manager
yum-builddep yum-debug-dump yumdownloader
vi /usr/bin/yum
更改以上文件头为
#!/usr/bin/python 改为 #!/usr/bin/python2.7  (也可以是python2,下同)

修改gnome-tweak-tool配置文件

# 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

Python安装常见问题(1):zipimport.ZipImportError: can’t decompress data
1. yum -y install zlib*
2. 进入 Python安装包,修改Module路径的setup文件:
vim module/setup
#zlib zlibmodule.c -I (prefix)/includeL (exec_prefix)/lib -lz 去掉注释
zlib zlibmodule.c -I (prefix)/includeL (exec_prefix)/lib -lz
3. make && make install

安装python3.6可能使用的依赖

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

你可能感兴趣的:(python,python)