Centos7下部署两套python版本并存
Centos7下部署两套python版本并存
需求说明:
centos7.2系统的开发机器上已经自带了python2.7版本,但是开发的项目中用的是python3.5版本,为了保证Centos系统的正常运行,以及节省机器资源(不想因此再申请另外一台开发机器部署python3.5),所以需要安装python3.5与python2.7共存的开发环境。具体操作记录如下:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
1)安装相关包[root@qd-vpc-rec-dev01 ~]# yum -y install epel-release[root@qd-vpc-rec-dev01 ~]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel2) 编译安装python3.5[root@qd-vpc-rec-dev01 ~]# yum -y install xz[root@qd-vpc-rec-dev01 ~]# wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz[root@qd-vpc-rec-dev01 ~]# tar xf Python-3.5.3.tar.xz -C /usr/local/src/[root@qd-vpc-rec-dev01 ~]# cd /usr/local/src/Python-3.5.3[root@qd-vpc-rec-dev01 Python-3.5.3]# ./configure --prefix=/usr/local/python3[root@qd-vpc-rec-dev01 Python-3.5.3]# make && make install从 Python 3.4 开始就已经自带了pip和easy_install(setuptools 包带的命令) 包管理命令,你可以在 /usr/local/python3/bin/ 目录下看到,查看一下已经安装的扩展包:[root@qd-vpc-rec-dev01 Python-3.5.3]# ll /usr/local/python3/bin/total 24080lrwxrwxrwx 1 root root 8 Sep 27 19:40 2to3 -> 2to3-3.5-rwxr-xr-x 1 root root 109 Sep 27 19:40 2to3-3.5-rwxr-xr-x 1 root root 250 Sep 27 19:40 easy_install-3.5lrwxrwxrwx 1 root root 7 Sep 27 19:40 idle3 -> idle3.5-rwxr-xr-x 1 root root 107 Sep 27 19:40 idle3.5-rwxr-xr-x 1 root root 222 Sep 27 19:40 pip3-rwxr-xr-x 1 root root 222 Sep 27 19:40 pip3.5lrwxrwxrwx 1 root root 8 Sep 27 19:40 pydoc3 -> pydoc3.5-rwxr-xr-x 1 root root 92 Sep 27 19:40 pydoc3.5lrwxrwxrwx 1 root root 9 Sep 27 19:40 python3 -> python3.5-rwxr-xr-x 2 root root 12309757 Sep 27 19:39 python3.5lrwxrwxrwx 1 root root 17 Sep 27 19:40 python3.5-config -> python3.5m-config-rwxr-xr-x 2 root root 12309757 Sep 27 19:39 python3.5m-rwxr-xr-x 1 root root 3088 Sep 27 19:40 python3.5m-configlrwxrwxrwx 1 root root 16 Sep 27 19:40 python3-config -> python3.5-configlrwxrwxrwx 1 root root 10 Sep 27 19:40 pyvenv -> pyvenv-3.5-rwxr-xr-x 1 root root 244 Sep 27 19:40 pyvenv-3.5[root@qd-vpc-rec-dev01 Python-3.5.3]# /usr/local/python3/bin/pip3 listDEPRECATION: 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)-----------------------------------------------------------------------------------------------------------------------------如果要更新pip,操作如下:[root@qd-vpc-rec-dev01 Python-3.5.3]# /usr/local/python3/bin/pip3 install --upgrade pip[root@qd-vpc-rec-dev01 Python-3.5.3]# /usr/local/python3/bin/pip3 list-----------------------------------------------------------------------------------------------------------------------------3)创建软连接[root@qd-vpc-rec-dev01 Python-3.5.3]# ln -s /usr/local/python3/bin/python3 /usr/bin/python34) 执行python -V查看Python是否安装成功。[root@qd-vpc-rec-dev01 Python-3.5.3]# python3 -VPython 3.5.3自带的版本为:[root@qd-vpc-rec-dev01 Python-3.5.3]# python -V Python 2.7.5[root@qd-vpc-rec-dev01 Python-3.5.3]# which python/usr/bin/python[root@qd-vpc-rec-dev01 Python-3.5.3]# which python3/usr/bin/python3[root@qd-vpc-rec-dev01 Python-3.5.3]# pythonPython 2.7.5 (default, Nov 6 2016, 00:28:07)[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>[root@qd-vpc-rec-dev01 Python-3.5.3]# python3Python 3.5.3 (default, Sep 27 2017, 19:38:56)[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linuxType "help", "copyright", "credits" or "license" for more information.>>>也就是说,python指令表示的是2.7.5版本,python3指令表示的3.5.3版本。开发项目里具体使用那个版本的python,就使用对应的全路径的python指令。 |
Centos7下部署两套python版本并存的更多相关文章
- Centos7下部署两套python版本并存环境的操作记录
需求说明:centos7.2系统的开发机器上已经自带了python2.7版本,但是开发的项目中用的是python3.5版本,为了保证Centos系统的正常运行,以及节省机器资源(不想因此再申请另外一台 ...
- CentOS7下部署2套Python版本共存
参考地址:https://www.cnblogs.com/xuaijun/p/7985245.html 源码的安装一般由3个步骤组成:配置(configure).编译(make).安装(make in ...
- 在Window平台下安装xgboost的Python版本
原文:http://blog.csdn.net/pengyulong/article/details/50515916 原文修改了两个地方才安装成功,第3步可以不用,第2步重新生成所有的就行了. 第4 ...
- Mac OS下使用pyenv管理Python版本
问题的由来 在开发过程中,可能会遇到多个版本同时部署的情况. Mac OS自带的Python版本是2.x,自己开发需要Python3.x 系统自带的是2.6.x,开发环境是2.7.x 由于Mac机器系 ...
- 在tomcat下部署两个或多个项目时 log4j和web.xml配置webAppRootKey 的问题(转)
在tomcat下部署两个或多个项目时 web.xml文件中最好定义webAppRootKey参数,如果不定义,将会缺省为"webapp.root",如下: <!-- 应用路径 ...
- CentOS7下部署rsync服务
说明: 在CentOS7下部署rsync服务和在CentOS6上部署基本上是一样的,只是CentOS7自带了rsyncd启动脚本,由systemd管理而已. rsync服务端配置 [root@SERV ...
- tomcat下部署两个工程时,只有一个可以访问,另一个出现404错误,该如何解决
tomcat下部署两个工程时,只有一个可以访问,另一个出现404错误,该如何解决 在开发新项目的时候,有时候为了省时,直接把曾经做过的项目工程A拷贝成改名为B工程,然后再在B工程上进行功能的开发, 此 ...
- Centos7下的有多个版本的tomcat部署项目并访问
在tomcat下部署项目,第一次访问成功.但是发现有一个页面没有成功加载,发现是部署时少了一些东西.也不想去找出具体少了什么,直接把原来的项目移除,重新加载项目.重启tomcat,这时惊喜来了. 重启 ...
- 转载:CentOS7下部署Django项目详细操作步骤
部署是基于:centos7+nginx+uwsgi+python3+django 之上做的 文章转自:Django中文网 https://www.django.cn/article/sh ...
随机推荐
- Delphi APP 開發入門(十)REST Client 開發
Delphi APP 開發入門(十)REST Client 開發 分享: Share on facebookShare on twitterShare on google_plusone_share ...
- The adidas NMD XR1 singapore is a bit more cool
The adidas NMD Singapore continues to be the right silhouette for summer time because of a mix of a ...
- Linux系统——shell脚本
shell脚本编程 作用:通过命令行解析的方式,自动执行设定好的程序或命令代码.(若将脚本挂到定时任务中,就会自动在非工作时间里自动触发执行程序) Shell脚本文件以“.sh”结尾 规范的Shell ...
- hdu2825Wireless Password
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2825 题目: Wireless Password Time Limit: 2000/1000 MS (Ja ...
- EF Core 2.0中怎么用DB First通过数据库来生成实体
要在EF Core使用DB First首先要下载三个Nuget包,在Nuget的Package Manager Console窗口中依次敲入下面三个命令即可: Microsoft.EntityFram ...
- 优秀 H5 案例收集 vol.4(不定期更新)
重返木叶村 http://hyrz.qq.com/act/a20160113muyecun/index.html 飞越淘宝奇市 https://g.alicdn.com/fdilab/flyover- ...
- imx6q android 添加开机启动脚本
1.在xx/out/target/product/sabresd_6dq/root/init.rc中添加以下内容 ========================================== ...
- git推送到github报错:error: The requested URL returned error: 403 Forbidden while accessing https://github.com
最近使用git命令从github克隆仓库到版本,然后进行提交到github时报错如下: [root@node1 git_test]# git push origin mastererror: The ...
- c#结构体和字节流之间的相互转换
结构体转byte数组 1 首先要明白 ,是 在那个命名空间下 System.Runtime.InteropServices; 2 首先得到结构体的大小 2 开辟相应的内存空间 3 将结构体填 ...
- Linux kernel 编译问题记录【转】
本文转载自:http://sunyongfeng.com/201701/programmer/linux/kernel_compile_fail.html 编译内核出现以下错误 Can't use ' ...