Cara mudah install python 3 di centos 7

Python is a popular, stable, and well-performing programming language. Many different Linux distributions use it, including CentOS 7.

Bạn đang xem: Cara mudah install python 3 di centos 7

CentOS 7 uses Pythuôn 2.7.5, but as Python has updated lớn 3.7.2. , this can create challenges. If the mặc định version of Pyeo hẹp is updated, it can break base system components lượt thích the yum package manager.

This guide will walk you through how to lớn install the most recent version of Pykhông lớn 3 on CentOS 7. We offer two options for installation on CentOS, via the SCL utility or from the source code.


Step 4: Create a Virtual Environment

1. Start by creating a directory to store your new project:

mkdir ~/python_projectcd ~/python_projectYou can rename the directory khổng lồ anything you prefer.

2. If you haven’t already, launch the SCL Python thả shell:

scl enable rh-python36 bash3. Create a new Pyhẹp virtual environment:

pyhẹp –m venv python_project_venv4. Activate the virtual environment:

source python_project_venv/bin/activateThe commvà prompt should change khổng lồ the name of the project you just created. You’re now working in Pyhẹp 3.6.

Option 2: Installing Pynhỏ bé 3 From Source Code

If you need a version of Pykhiêm tốn that is not supported through SCL, you can download a copy of the source code. This method requires additional software, plus extra steps to lớn compile and install the Pythanh mảnh package.

1. Start by installing the gcc, open-ssl-devel, và bzip2-devel packages:

suvày yum install gcc openssl-devel bzip2-devel
2. Browse lớn a directory to lớn tải về the files:cd usr/src

3. Download the Pykhông lớn version you want to lớn install:

suvì chưng wget https://www.pynhỏ bé.org/ftp/python/3.7.2/Python-3.7.2.tgz
4. Extract the package:

suvị tar xzf Python-3.7.2.tgz5. Compile the source code inlớn an installation package:

cd Python-3.7.2.tgz./configure ––enable–optimizationsmake altinstallThe make comm& builds the installer package. The altinstall commvà instructs your system lớn create a second installation of this version of Pykhiêm tốn. Without it, the system would replace the default version of Pynhỏ nhắn.

6. Verify the software version:

python3.7 –vThe system should display:

Python 3.7.2Conclusion

This guide provided two different ways on how to install the lathử nghiệm version of Python3, 3.7.2 on CentOS 7. For the newer version of CentOS, kiểm tra out our article on how to lớn install Pybé on CentOS 8.

Xem thêm: Mở Quyền Admin Trong Win 10, Cách Cấp Quyền Admin Cho User Trong Win 10

Remember that it is essential khổng lồ create a second installation, so you don’t accidentally break the functionality of other tools that rely on the older Pybé nhỏ 2.7.5.

With everything mix, you can start with some basics scripts lượt thích getting the current time and date in Pykhông lớn.

Was this article helpful?
Share on Twitter Share on Facebook Share on LinkedIn Share on Email
Sofija Simic
Sofija Simic is an aspiring Technical Writer at Alongside her educational background in teaching & writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts & streamlining intricate software installations.
Next you should read
DevOps & Development SysAdmin
How khổng lồ Check Python thả Version in Linux, Mac, và Windows
October 1, 2019
Pyeo hẹp is a popular programming language with different versions organized by release date...
Read more
DevOps & Development SysAdmin
How to Install Pip on CentOS 7
January 17, 2019
Pip Installs Packages (Pip) is a package management system that simplifies the process of installing and...
Read more
SysAdmin Web Servers
How khổng lồ Install phpMyAdmin on CentOS 7
October 22, 2018
This guide is for users who have sầu already configured a CentOS VPS and installed the Apađậy HTTP.. services...

Xem thêm: Thiết Kế Logo Đơn Giản Mà Đẹp, 20 Mẫu Logo Đơn Giản Mà Hiệu Quả

Read more
Backup & Recovery MySQL SysAdmin
How khổng lồ Baông chồng Up & Restore a MySQL Database
October 22, 2018
A MySQL database has been lost, and you"re scrambling to restore a copy from your last backup...
Read more
Recent Posts
Live sầu Chat ↗

Chuyên mục: Kiến thức Hosting