This article describes how to install Python interpreters in various systems. Python has been installed by default in many Linux distributions. For more information, see
Python download
The latest Python source code, binary documents, and news can be viewed on the Python official website:
Python official website: http://www.python.org/
You can download Python documents from the link. you can download documents in HTML, PDF, and PostScript formats.
Python document: www.python.org/doc/
Python installation
Python has been ported to many platforms (changed to enable it to work on different platforms ).
You need to download the binary code for your use of the platform, and then install Python.
If the binary code on your platform is unavailable, you need to use the C compiler to manually compile the source code.
The compiled source code has more features and provides more flexibility for python installation.
The following describes how to install Python on different platforms:
Install Python on Unix and Linux platforms:
Follow these steps to install Python on Unix and Linux:
Open WEB browser access http://www.python.org/download/
Select the source code compressed package for Unix/Linux.
Download and decompress the compressed package.
If you need to customize some options to modify Modules/Setup
- Execute the./configure script
- Make
- Make install
After the above operations are performed, Python will be installed in the/usr/local/bin directory, and the Python library will be installed in the/usr/local/lib/pythonXX and XX Python version numbers for you.
Windows platform Python installation:
Follow these steps to install Python on the Windows platform:
Open WEB browser access http://www.python.org/download/
In the download list, select the Window platform installation package in the format of: python-XYZ.msi file, XYZ for the version you want to install.
To use the Installer python-XYZ.msi, Windows must support Microsoft Installer 2.0. Just save the installation file to your local computer and run it to see if your machine supports MSI. Windows XP and later versions already have MSI, and many old machines can also install MSI.
After downloading the package, double-click it to go to the Python installation wizard. the installation is very simple. you only need to use the default settings and click "next" until the installation is complete.
Install Python on MAC:
Recent Mac OS systems all have their own Python environment, but the built-in Python version is the old version, you can view the new version of Python on MAC through the http://www.python.org/download/mac/ link introduction.
Complete Python installation tutorial on MAC you can view: http://homepages.cwi.nl /~ Jack/macpython/index.html
Environment variable configuration
Programs and executable files can be stored in many directories, which may not be in the search path that the operating system provides executable files.
Path is stored in the environment variable, which is a named string maintained by the operating system. These variables contain information about available command line interpreters and other programs.
In Unix or Windows, the PATH variable is PATH (UNIX is case sensitive, and Windows is case insensitive ).
In Mac OS, the python installation path is changed during installation. If you need to reference Python in another directory, you must add the Python directory in path.
Set environment variables in Unix/Linux
In csh shell: Enter
setenv PATH "$PATH:/usr/local/bin/python"
, Press "Enter ".
In bash shell (Linux): Enter
export PATH="$PATH:/usr/local/bin/python"
, Press "Enter ".
In sh or ksh shell: Enter
PATH="$PATH:/usr/local/bin/python"
, Press "Enter ".
Note:/usr/local/bin/python is the installation directory of Python.
Set environment variables in Windows
Add the Python directory to the environment variable:
In the command prompt box (cmd): Enter
path %path%;C:\Python
, Press "Enter ".
Note: C: \ Python is the installation directory of Python.