我是靠谱客的博主 纯真冰淇淋,最近开发中收集的这篇文章主要介绍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 --enable-optimizations
# make
# make altinstall

修改软链接:

修改之前一定要对以存在的/usr/bin/python更名,否则出现如下错误

ln: failed to create symbolic link ‘/usr/bin/python’: File exists

可修改为:

# mv python python_old

························当然任意名字都可

终于可以修改软链接了

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

最后修改yum/gnome-tweak-tool/urlgrabber配置文件,否则之后使用yum可能报错

[root@VM_0_8_centos bin]# ls -ol yum*
-rwxr-xr-x  1 root   802 May 24 23:05 yum
-rwxr-xr-x  1 root  9430 May 24 23:06 yum-builddep
-rwxr-xr-x  1 root  9040 May 24 23:05 yum-config-manager
-rwxr-xr-x  1 root  7610 May 24 23:06 yum-debug-dump
-rwxr-xr-x  1 root  7904 May 24 23:07 yum-debug-restore
-rwxr-xr-x. 1 root 10999 Aug 11  2017 yumdownloader
-rwxr-xr-x  1 root 11032 May 24 23:07 yum-groups-manager

以上文件都要修改文件行首处 #!/usr/bin/python

改为 #!/usr/bin/python2

输入:

# vim yum-builddep

[root@VM_0_8_centos bin]# vim yum-builddep

#!/usr/bin/python -tt        !!!!!!!!!!!!!!!!!!就是改这里 加个2 ·················哈哈

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
····························省略一万字


gnome-tweak-tool/urlgrabber配置文件修改同上 ·········gnome-tweak-tool可能无须配置

最后查看安装版本:

# python -V
# pip -V




最后

以上就是纯真冰淇淋为你收集整理的centos7安装python3.6.5!!!!最新最详细的全部内容,希望文章能够帮你解决centos7安装python3.6.5!!!!最新最详细所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部