Bluehost uses the preinstalled version of Python that ships with CentOS, the enterprise class operating system (a Linux distribution). This means that the version available to you may not be the latest one. In this article, we talk about what is Python, how is it useful and how to install Python 2.7 and other versions.

 

Python and its Applications

Python is a programming language used for server-side web development, software development and system scripting. It can be used on a server to create web applications, create workflows, read, and modify files and for rapid prototyping. This language can work on different platforms including Windows, Mac, Linux, and Raspberry. Python runs on an interpreter system which means that its code can be executed as soon as it is written.

Python is pre-installed on most Linux distributions like CentOS and Ubuntu and macOS. On Windows, you will need to download and install it.

 

What is PIP and When Do You Need It?

PIP or Preferred Installer Program Is a package management system that is used to install and manage software packages that have been written in Python. Once installed in your system, PIP allows you to download, install or uninstall any software product that is python compliant by using a single command.

If you are using an older version of Python on windows you may need to install PIP by downloading the installation package and following it up with the opening of the command line and launching of the installer. The latest versions of Python (2.7.9+ and 3.4+) come with PIP pre-installed, but you will require to manually install the same in the older versions. Read on to know more about how to install PIP in Python 2.7.

Before you install PIP in Windows, do check if it is already there by typing the following command in the command prompt: pip help

If you get an error saying that the program could not be found, you will need to install it. And if installed, it will respond.

 

How to Install Python 2.7 to Your Bluehost Account?

If you wish to install python locally, you will need to be added to the compiler group. You can do this by contacting our Support section.

To find out which version of python is installed in your system you need to run the Python –V command:

python-versionCopy.

The command will print the default python version in your system. The code for python 2 and python 3 versions are different.

Now if you wish to update to a newer version, following steps are required.

Step 1: Download Python

Enter the following commands to download and extract Python 2.7 to your Bluehost Web hosting account:

  • mkdir ~/python
  • cd ~/python
  • wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
  • tar zxfv Python-2.7.2.tgz
  • find ~/python -type d | xargs chmod 0755
  • cd Python-2.7.2

 

Step 2: Now that you have downloaded the language, you need to configure and install it.

Use the following commands to do it:

  • ./configure –prefix=$HOME/python
  • make
  • make install

 

Step 3: Modify the.bashrc.

This is needed to load the local version of python. Use the following commands:

vim ~/.bashrc

Press i
Enter:

export PATH=$HOME/python/Python-2.7.2/:$PATH            

Write the changes (press ESC) and close vim:

:wq             

Press Enter

source ~/.bashrc

 

You may need to logout of the system for the environment to update. You can enter Python-V to check the version that is now installed.  

 

How to Install Python 2.7 to Ubuntu Operating System?

The answer to how to install python 2.7 in Ubuntu lies in which version of the operating system you have and whether you have all the prerequisites installed.

 

Step 1: To install the latest version of python (from series 2 or 3) on your Ubuntu operating system you need to have certain prerequisites installed in your system.

 

Step 2: Once you have installed all the prerequisites, download python from its official site. Specify the version you wish to download.

 

Step 3: In the next step compile Python source code on your system using altinstall which prevents the replacement of the default python binary file/usr/bin/python.

 

You can follow this up by running the python test suite to ensure that the new installation is working as per expectations. In case you still have any queries related to how to install python 2.7, do get in touch with our support team.

Write A Comment