html tool

2021年8月19日星期四

转:通过源码安装python3

 https://www.liquidweb.com/kb/how-to-install-python-3-on-centos-7/

Next, we need to grab the version of Python we want. The following command will pull down the latest stable version of Python 3.8 as of the writing of this article.

[root@centos7 ~]# curl -O https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz

Now we need to extract the file.

[root@centos7 ~]# tar -xzf Python-3.8.1.tgz

Step 3: Install Python 3

Now that it’s extracted, let’s change into the resultant directory.

[root@centos7 ~]# cd Python-3.8.1/

Next, we need to prepare to compile Python from source.

[root@centos7 Python-3.8.1]# ./configure --enable-optimizations

Finally, we are going to use the following command to finish off the installation, without replacing the default system Python on our system.

[root@centos7 Python-3.8.1]# make altinstall

Compiling code from source takes a little while, but once that’s finished, we can test out our new Python 3 version by running the following command.

[root@centos7 Python-3.8.1]# python3.8

Much like before when we installed Python 3.6 via Yum, we are dropped into a Python shell that outputs the version we are currently using.

Python 3.8.1 (default, Dec 27 2019, 17:12:30)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

没有评论:

发表评论