美文网首页
从头安装4 --python3环境

从头安装4 --python3环境

作者: 丁逸 | 来源:发表于2017-08-16 16:56 被阅读0次

个人备注网页, 不喜勿扰


安装此部分功能时需要注意文件夹位置!!!!!


1.最小化安装的centos 有很多编译环境没有 需要安装
为了省事 可以全部安装
[root@base ~]# yum groupinstall -y "Development tools"

出现 :警告:分组 development 不包含任何可安装软件包。

执行 yum clean all 再执行上边的命令

[root@base ~]# yum install -y openssl-devel
[root@base ~]# yum install -y zlib
[root@base ~]# yum install -y zlib-devel

2.需要安装Python3.5
[root@base ~]# tar -zxf downloads/Python-3.5.3.tgz

[root@base ~]# cd Python-3.5.3/

[root@base Python-3.5.3]#./configure --prefix=/root/python3

[root@base Python-3.5.3]# make

[root@base Python-3.5.3]# make test

[root@base Python-3.5.3]# make install

[root@base Python-3.5.3]# cd /usr/bin

删除原有软连接

[root@base bin]# rm -rf python

[root@base bin]# ln -s /root/python3/bin/python3 ./python

[root@base bin]# ln -s /root/python3/bin/python3 ./python3

[root@base bin]# ln -s /root/python3/bin/pip3 ./pip3

3.验证是否成功

[root@base bin]# python
Python 3.5.3 (default, Aug 10 2017, 15:01:00)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@base bin]# python3
Python 3.5.3 (default, Aug 10 2017, 15:01:00)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@base bin]# pip3 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (28.8.0)

4.yum 中需要修改部分头文件
[root@base bin]# vi yum

将第一行

!/usr/bin/python

修改为

!/usr/bin/python2.7

相关文章

网友评论

      本文标题:从头安装4 --python3环境

      本文链接:https://www.haomeiwen.com/subject/qkwjlxtx.html