Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compile and install python3 under Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to compile and install python3 under Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to compile and install python3 under Linux".

First of all, go to the official website of python to download the source package of python3.

After going in, click the downloads in the navigation bar, or you can put the mouse on the downloads pop-up menu to select source code, which means the source package. Here you choose the latest version 3.5.1. Of course, there are many other historical versions below. After clicking in, you can see the download link at the bottom of the page, including the source package, mac osx installation package, and windows installation package.

You can choose the first download here, and what you download is the source code package: python-3.5.1.tgz. After downloading, upload it to the server and prepare for installation.

Release the file:

Tar-xvzf python-3.5.1.tgz

Enter the directory:

Cd python-3.5.1/

Add configuration:

. / configure-- prefix=/usr/python

Configure your own installation directory here, and then compile the source code:

Make

Perform the installation:

Make install

The whole process takes about 5-10 minutes. After the installation is successful, the installation directory is in / usr/python.

The original python in the system is in / usr/bin/python. Through ls-l, you can see that python is a soft link, which links to the python2.6 in this directory.

We can delete this, or we can create a new soft link for python3, but the python should be changed to python3 during execution, or the python script header declaration should be changed to #! / usr/bin/python3

For convenience, it is recommended to rename it first, and then set up a soft link, and the previous program header does not need to be changed:

$mv / usr/bin/python / usr/bin/python.bak$ ln-s / usr/python/bin/python3 / usr/bin/python Thank you for reading, this is the content of "how to compile and install python3 under Linux". After the study of this article, I believe you have a deeper understanding of how to compile and install python3 under Linux. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report