User:Milanandreew/Python 3 Programming/Getting Python

In order to program in Python you need the Python interpreter. If it is not aleady installed or if the version you are using is obsolete, you will need to obtain and install Python using the methods below:

Python 2 vs Python 3
In 2008, the PSF released version 3.0 of the core Python distribution. As Python 3 is incompatible with earlier versions of Python, many developers still relied heavily on Python 2, even after the Python Software Foundation officially marked it as end of life in 2020. You should be aware of the fact that you're still liable to find teaching resources focused on Python 2. As of time of writing (June 2021), the latest version of Python 3 is Python 3.9.5.

Windows
Go to the Python download page and get the version you want. Download it, read the instructions and get it installed.

In order to run Python from the command line, you will need to have the python directory in your PATH, so be sure to check the relevant option in the installer. Alternatively, you could use an Integrated Development Environment (IDE) for Python like Python's own IDLE (which ships with every version of Python since 2.3).

Cygwin
By default, the Cygwin installer for Windows does not include Python in the downloads. However, it can be selected from the list of packages.

macOS
Apple's macOS, up to the latest version (macOS 11 'Big Sur'), comes preinstalled with Python 2. Attempting to use Python 3 from the command line will prompt you to install the Xcode Command Line Lools, but most users are better served by downloading the latest version from the Python download page.

Linux
Python is available as a package for most Linux distributions, if it doesn't come preinstalled by default, making it unnecessary to build it from source.

Debian/Ubuntu
Users of Debian and other distributions derived from it will most likely be able to use the latest stable version shipped in their repo via the  binary. If it's not installed already, you can use apt to get it:.

Fedora/CentOS etc.
Users of Red Hat Linux and other distributions derived from it will most likely be able to use the latest stable version shipped in their repo via the  binary. If it's not installed already, you can use apt to get it:.

Arch Linux
Arch Linux does not come with Python pre-installed by default, but it is easily available for installation through the package manager to pacman. As root (or using sudo if you've installed and configured it), type:

This will be update package databases and install Python 3. Other versions can be built from source from the Arch User Repository.

Source code installations
Some platforms do not have a version of Python installed, and do not have pre-compiled binaries. In these cases, you will need to download the source code from the official site. Once the download is complete, you will need to unpack the compressed archive into a folder.

To build Python, simply run the configure script (requires the Bash shell) and compile using make.

Other Distributions
Python, which is also referred to as CPython, is written in the C Programming language. The C source code is generally portable, that means CPython can run on various platforms. More precisely, CPython can be made available on all platforms that provide a compiler to translate the C source code to binary code for that platform.

Apart from CPython there are also other implementations that run on top of a virtual machine. For example, on Java's JRE (Java Runtime Environment) or Microsoft's .NET CLR (Common Language Runtime). Both can access and use the libraries available on their platform. Specifically, they make use of reflection that allows complete inspection and use of all classes and objects for their very technology.

Python Implementations (Platforms)

Integrated Development Environments (IDE)
CPython ships with IDLE, which should be sufficient for beginners. If you're looking for something a bit more powerful, you might find Wikipedia's Python IDE comparison useful, as well as the Python Wiki's article on the same subject.

Trying Python online
You can try Python online, thereby avoiding the need to install.

Links:
 * Python shell, python.org
 * Python 3 REPL, repl.it
 * Python 2 REPL, repl.it

Keeping Up to Date
Python has a very active community and the language itself is evolving continuously. Make sure to check python.org for recent releases and relevant tools. The website is an invaluable asset.

Public Python-related mailing lists are hosted at mail.python.org. Two examples of such mailing lists are the Python-announce-list to keep up with newly released third party-modules or software for Python and the general discussion list Python-list. These lists are mirrored to the Usenet newsgroups comp.lang.python.announce & comp.lang.python.