Home > Article > Operation and Maintenance > Detailed explanation of the process of installing python3 under linux
This article mainly introduces the steps to install python3 under centos7. The editor thinks it is quite good. Now I will share it with you and give it as a reference. Let’s follow the editor to take a look
Environment setup
Preparation tools:
centos7:mirror.bit.edu.cn/centos/7 /isos/x86_64/CentOS-7-x86_64-DVD-1611.iso
virtuslvox:www.virtualbox.org/wiki/Downloads
subline
secureCRT
1. After installing the virtual machine, add the image file and select minimal to minimize the installation
yum update#更新软件 yum -y install gcc kernel-devel kenel-headers make bzip2 # 安装依赖库 reboot # 重启
2. Mount the execution script
mount /dev/cdrom /mnt # 挂载光驱到 mnt 目录 cd /mnt # 进入到mnt目录 sh ./VBoxLinuxAdditions.run # 执行脚本,进行安装 reboot #重启
3. Take a snapshot for future recovery
4. Installation of python environment (install pyenv)
centos configuration
$ yum install readline readline-devel readline-static -y $ yum install openssl openssl-devel openssl-static -y $ yum install sqlite-devel -y $ yum install bzip2-devel bzip2-libs -y $ yum install patch vim git
Install python3.3/pip3
#安装python3.3 $ sudo mkdir /usr/local/python3 # 创建安装目录 $ wget --no-check-certificate https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz #下载源文件。注意:wget获取https的时候要加上:--no-check-certificate $ tar -xzvf Python-3.6.0.tgz # 解压缩包 $ cd Python-3.6.0 # 进入解压目录 #编译安装 $ sudo ./configure --prefix=/usr/local/python3 # 指定创建的目录 $ sudo make $ sudo make install #配置2个版本共存 $ sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3 #创建 python3 的软链接,这样就可以通过 python 命令使用 Python 2,python3 来使用 Python 3。 #修改默认为 Python 3 $ sudo mv python python.bak $ sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python #创建 python3 的软链接 $ sudo vi /usr/bin/yum #因为 yum 使用 Python 2,因此替换为 Python 3 后可能无法正常工作,因此修改 yum 配置文件。将第一行指定的 python 版本改为 python2.7(#!/usr/bin/python 改为 #!/usr/bin/python2.7)
#源码安装 pip $ wget --no-check-certificate https://github.com/pypa/pip/archive/9.0.1.tar.gz# 下载源代码 $ tar -zvxf 9.0.1 -C pip-9.0.1 # 解压文件 $ cd pip-9.0.1 $ python3 setup.py install# 使用 Python 3 安装 $ sudo ln -s /usr/local/python3/bin/pip /usr/bin/pip3 #创建链接 $ pip install --upgrade pip # 升级 pip
Install setuptools
##
tar -xvf setuptools-1.4.2.tar.gz cd setuptools-1.4.2 python setup.py install【Related recommendations】1. 2.
Detailed explanation of innodb_index_stats when importing data Error prompting table primary key conflict
3.Example details innodb_autoinc_lock_mode in mysql
4.Detailed example of adding new user permissions in MySQL##5.
Detailed example of init_connect method in mysqlThe above is the detailed content of Detailed explanation of the process of installing python3 under linux. For more information, please follow other related articles on the PHP Chinese website!