{"id":25978,"date":"2018-03-23T04:29:52","date_gmt":"2018-03-23T09:29:52","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=25978"},"modified":"2022-12-12T09:10:08","modified_gmt":"2022-12-12T15:10:08","slug":"how-to-install-python-3-6-4-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-python-3-6-4-on-centos-7\/","title":{"rendered":"How to Install Python 3.6.4 on CentOS 7"},"content":{"rendered":"
<\/p>\n
We’ll show you how to install Python 3.6.4 on CentOS 7. Python is at the core of many popular websites and programs – YouTube, Instagram, and even Yum on CentOS, to name a few. They all rely on Python’s reliability and performance to complete many tasks at a time. Python is a general-purpose object-oriented programming language designed to be used as a software solution for almost all kinds of problems. However, the pre-installed version of Python found on CentOS VPS<\/a> is a much older version. In order to have the latest version of Python, the user will have to install it manually.<\/p>\n In this tutorial, we will show you two methods of installing Python version 3.6.4 on your CentOS 7 machine. The reason there are two methods is that Python 3.6.4 does not come by default in the built-in Yum repositories<\/a>. So, we can either compile Python on our machine from the source code or add a repository that has a pre-compiled version of Python for CentOS 7.<\/p>\n This is the easier method of the two for installing Python<\/a> on your machine. Here, we simply add a repository that has the pre-compiled version ready for us to install. In this case, we are adding the Inline with Upstream Stable<\/strong> repository, a community project whose goal is to bring new versions of software to RHEL-based systems.<\/p>\n This will not only install Python – but it will also install pip to help you with installing add-ons.<\/p>\n Once these commands are executed, simply check if the correct version of Python has been installed by executing the following command:<\/p>\n You have now finished installing Python 3.6.4 on your CentOS 7 machine, as well as installing a native Python package management tool called pip.<\/p>\n This is the more complicated method of the two, and will take more time – however, this method gives you more control over what gets installed and what doesn’t. It can also be more secure at times, depending on where the software package is downloaded from.<\/p>\n Important:\u00a0<\/strong>Keep in mind that your Yum package manager will not know<\/strong>\u00a0that you have installed Python 3.6.4 (or any other software) if you install software by manually compiling the source code. This means that no updates<\/strong> will be available for your manually installed software.<\/p>\n First, we will need the tools in order to be able to compile and install programs from their source code. To do this, we will install the group \u201cDevelopment Tools\u201d through Yum itself:<\/p>\n Once this is done, move on to step 2.<\/p>\n First, we need to create a directory in which our install will take place. Make a directory with a name of your choosing, then enter the directory. Once you are in your new directory, enter the following command to download the compressed Python source file.<\/p>\n Once the file is finished downloading, uncompress the file by using tar, then enter into the new directory that was just created:<\/p>\n Use the following command to have the installation software check your system before actually starting the installation process.<\/p>\n This command ensures that the install will work, along with creating a special \u2018makefile\u2019 that is unique to your system. This makefile is what you will use to install Python onto your system.<\/p>\n Now we can finally execute the makefile. Run the following command to install Python onto your system. Note: This will take a few minutes. The speed of the compilation and installation will depend on the speed of your processor.<\/p>\n First, we run the \u2018make\u2019 command which compiles the program.<\/p>\n Then, once that is finished, we can run the installation command.<\/p>\n Once this command finishes, you will have installed Python successfully, along with pip and setuptools. From here, creating a virtual environment<\/a> is easy, and coding and executing the latest Python code is now possible.<\/p>\n Of course, you don\u2019t have to install Python 3.6.4 on CentOS 7, if you use one of our high-speed Python VPS hosting<\/a>\u00a0plans – in which case you can simply ask our expert Linux admins to install Python 3.6.4 for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS.<\/strong><\/span> If you liked this post, on how to install Python 3.6.4 on CentOS 7, please share it with your friends through social networks or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" We’ll show you how to install Python 3.6.4 on CentOS 7. Python is at the core of many popular websites … <\/p>\nMethod 1: Install Python 3.6.4 on CentOS 7 From a Repository<\/h2>\n
Step 1: Open a Terminal and add the repository to your Yum install.<\/h3>\n
sudo yum install -y https:\/\/repo.ius.io\/ius-release-el7.rpm<\/pre>\n
Step 2: Update Yum to finish adding the repository.<\/h3>\n
sudo yum update<\/pre>\n
Step 3: Download and install Python.<\/h3>\n
sudo yum install -y python36u python36u-libs python36u-devel python36u-pip<\/pre>\n
python3.6 -V<\/pre>\n
Method 2: Compiling Python 3.6.4 on CentOS 7 From Source Code<\/h2>\n
Step 1: Install the development tools needed for compilation.<\/h3>\n
sudo yum groupinstall -y \"Development Tools\"<\/pre>\n
Step 2: Download the Python source files.<\/h3>\n
wget https:\/\/www.python.org\/ftp\/python\/3.6.4\/Python-3.6.4.tar.xz<\/pre>\n
tar -xJf Python-3.6.4.tar.xz\r\ncd Python-3.6.4<\/pre>\n
Step 3: Run the configuration script.<\/h3>\n
.\/configure<\/pre>\n
Step 4: Install Python.<\/h3>\n
make<\/pre>\n
make install<\/pre>\n
\n