Knowledge Base
MilesWeb / Web Hosting FAQ

Learn how to configure and use a newer version of Python

Approx. read time : 2 min

This article guides you on how you can configure and use a new version of Python. You may need to do it when :
• You have a managed server account and you want to use new Python version than what is already installed on the server.

Note: This applies to all hosting accounts that have cPanel, including shared and reseller server.

• You have an unmanaged server account, and the package repositories for your Linux distribution contain an older version of Python.

Before proceeding with this article make sure that you have a compiler and other development tools installed on your server.

Let’s get started.

# Steps to configure managed servers

Your account can be located on a managed server that already has an older version of Python installed. So, if you wish to run a new version of Python, you can compile it by using this source code.
Perform the following steps to compile Python from the source code :

1. Using SSH, log in to your account.

2. Type following command in the command prompt :

Note: This command explains how to install Python version 3.5.2. If you want to install a different version, then visit https://www.python.org/ftp/python/ to view the other versions that are available for download. Once you select a version, run the previous commands with the version number that you have selected at the place of 3.5.2.

3. To configure your shell environment and to use the new compiled executable, type the following command.

Replace the username with your MilesWeb hosting account username.

4. In order to confirm that your account is configured to use the new version, type the following command :

# Steps to install virtualenv

To create virtual environments by using your installed version of Python, you first need to install the virtualenv program. Type following command to do this :

You are then allowed to create a virtual environment by running the virtualenv program in the bin directory. For example: if you want to create a virtual environment named testenv, type the following command :

Type the following command, to activate the new environment.

#Steps to configure unmanaged servers

There is a possibility that the package repositories for your Linux distribution may contain the older version of the Python. But, if you want to run the new version of Python, then you can compile it from the source code. Perform the following steps to do so:

1. Using SSH, log in to your account.

2. Type the following command in the prompt, as a root user:

3. In order to configure the shell environment and to use the new compiled executable, type the following command :

Replace executable_path with the path to the compiled Python executable (example, /usr/local/bin).

4. To confirm if your account is configured to use the new version, type the following command :

For more information about Python, visit https://www.python.org

Also Read :

1)How to Create the End User Access for Python and Ruby Selector?

Sonam Wagh
With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.
Need help? We’re always here for you.