[教程]在宝塔面板环境下,安装Python3,防止和宝塔Python2.7冲突
1月24日更新• Python3 • 宝塔 • 宝塔面板•教程•阅读:10,421次
在宝塔面板环境下,安装Python3,防止和宝塔Python2.7冲突
1.下载python3安装包并解压
- wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
- tar –xzvf Python–3.6.0.tgz
2、进入解压,编译安装包,指定安装路径,并执行安装命令
- cd Python–3.6.0
- ./configure –prefix=/usr/local/python36 #注意:prefix参数用于指定将Python安装在新目录,防止覆盖系统默认安装的python
- make && make install
3.建立软链接(python3的环境变量)
- ln –s /usr/local/python36/bin/python3.6 /usr/bin/python3
4、完成
- [root@Rserver–1 Python–3.6.0]# python3
- Python 3.6.0 (default, May 25 2017, 11:39:00)
- [GCC 4.4.7 20120313 (Red Hat 4.4.7–18)] on linux
- Type “help”, “copyright”, “credits” or “license” for more information.
- >>>
- >>>