Newly installed Ubuntu system to compile and install Python3.7.0 environment

Newly installed Ubuntu system to compile and install Python3.7.0 environment

Newly installed systems generally have nothing, we need one by one to upgrade, install, we first look at apt-get upgrade

sudo apt-get update

Then we install what gcc environment because we need to use the installation Python3.7 C compiler

sudo apt-get gcc

We rely on it to install the environment Python3.7

sudo apt-get install libffi-dev

After installing the package Python3.7 us to download and install, and can be downloaded to the network after passing Quguan Ubuntu system, download address https://www.python.org/ftp/python/3.7.0/Python-3.7.0 .tgz or later can use shell commands in Ubuntu download, go to the location you want to download,

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
```
下载完之后我们创建一个文件夹用于安装位置 
````bash
sudo mkdir /usr/local/bin/python3.7
```
我们将终端位置移动到下载好文件的位置,然后进行解压文件
```bash
sudo tar -zxvf Python-3.7.0.tgz
```
解压完成后进入到解压好的文件夹中
```bash
cd Python-3.7.0/
```
进行配置安装位置,,这里安装位置选择刚刚我们创建的文件夹,也可以选择别的位置
```bash
./configure --prefix=/usr/local/bin/python3.7/
```
下面进行编译
````bash
sudo make
```
编译完成之后进行安装
````bash
sudo make install
```
这样python3.7.0就编译安装好了,下面我们来创建软连接,如果Ubuntu中以及有python3软连接的,我们先删除(不确定有没有的也可以删除一下)。

sudo rm /usr/bin/python3

然后进行创建软连接
````bash
sudo ln -s /usr/local/bin/python3.7/bin/python3.7 /usr/bin/python3

Soft connection has been created, now we enter python3 -v out python3.7.0 is installed successfully

These are compiled on a new Ubuntu system-wide installation of course python3.7.0

Published 139 original articles · won praise 67 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_43422111/article/details/104816917