DEV Community

Cover image for Install Python
Python64
Python64

Posted on

Install Python

Python is installed by default on Mac OS X or Linux. But you may want to use Windows or install another version of Python. In this article we'll cover several things:

  • Python installation
  • Installation of Linux systems
  • windows system installation
  • Installation of Mac OS X systems
  • Install with ActivePython

Python installation

The things that you need to install are all in this page:
www.python.org/downloads/

Download the newest Python from there.

If you are new to Python, you may like the Python crash course

Installation of Linux systems

Python is cross-platform. It is already installed by default on most Linux distributions.

If you have to install it yourself, you can use your package manager to install it. On Ubuntu you can use apt-get:

sudo apt-get update
sudo apt-get install python3.6

From source

If you like to do things the hard way:

  • Download source code from the website
  • Decompression source pack
tar -zxvf Python-3.7.0.tgz
  • Compile
cd Python-3.7.0 ./configure -prefix=/usr/local make && make install

After the installation is good, enter the shell and type python and see the following:

$ python3
Python 3.7.5 (default, Nov 20 2019, 09:21:52) 
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Congratulations, the installation was successful.

Installation of windows systems

Go to (https://www.python.org/downloads/) find the windows installation package, download, for example, download this file: python-3.7.0.msi. Then it is a constant "next step" to complete the installation.

After installation, you need to check whether there is python in the environment variables.

If you don't know what is a windows environment variable and how to set it. Don't worry, search: "windows environment variable" on google.

The above is done. In cmd, enter python and you should see something like this:

$ python3
Python 3.7.5 (default, Nov 20 2019, 09:21:52) 
[GCC 9.2.1 20191008] on windows
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Installation of Mac OS X systems

In general, the Mac OS x systems have already installed a version of python, which can be used. If you want another, you can use brew.

But windows Python are definitely not installed.

In addition to the installation of the method mentioned above, there is also a more provincial approach, which is to install: ActivePython

Install with ActivePython

This ActivePython is a Python suite of several operating systems that includes a complete Python release, a Python programming IDE, and some Python. If interested visit their official website at : http://www.activestate.com/activepython

Use Source Installation

python is open-source and its source code is all online. You can https://www.python.org/ftp/python/, download the source code.

Then run these commands in the shell:

  1. Access root
  2. Download some version of python to the above address: wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
  3. Extract:
tar xfz Python-3.7.0.tgz
  1. Enter the directory:
cd Python-3.7.0
  1. Configuration:
./configure
  1. Run in the above folder: make, then run: make install
  2. Good luck
  3. Installation completed

OK! After you have installed it, you can start programming right away.

Related links:

Top comments (0)