May 10, 2021 Python3
Python's latest source codes, binary documents, news, and more can be found on Python's website:
You can download Python's documents in the links below, and you can download documents in formats such as HTML, PDF, and PostScript.
Here's how to install Python on different platforms:
Here are some simple steps to install Python on the Unix and Linux platforms:
Python-3.x.x.tgz
3.x.x
your download of the corresponding version number.
Take Python 3.8.5:
# tar -zxvf Python-3.8.5.tgz
# cd Python-3.8.5
# ./configure
# make && make install
Check that Python3 is working properly:
# python3 -V
Python 3.8.5
Here are the easy steps to install Python on the Windows platform:
python-3.8.5-amd64.exe
-3.8.5
for the version number you want to install,
-amd64
system version.
Windows x86-64 is a 64-bit version
Windows x86 is a 32-bit version
MAC systems typically come from environments with Python 2.7 versions, and you can also download the latest https://www.python.org/downloads/mac-osx/ installation on the link to the website.
setenv PATH "$PATH:/w3cschool/local/bin/python"
Press Enter.
export PATH="$PATH:/w3cschool/local/bin/python"
Press Enter.
PATH="$PATH:/w3cschool/local/bin/python"
Press Enter.
Note:
/w3cschool/local/bin/python
Python's installation directory.
Add a Python directory to the environment variable:
In the command prompt box (cmd): Enter
path=%path%;C:\Python
Press Enter.
Note: C: .Python is Python's installation directory.
You can also set it up by:
Path
line, just add the python installation path (my D: .Python32), so add the path later. p
s: Remember, the path uses a half sign
;
"Separate!
python
and you can have a relevant display.
Here are a few important environment variables that apply to Python:
variable name | describe |
---|---|
PYTHONPATH | PythonPath is a Python search path. The default we import modules will be found from PythonPath. |
PYTHONSTARTUP | After Python is started, look for the PythonStartUP environment variable and then perform the code in the file specified by this variable. |
PYTHONCASEOK | Join the environment variable of PythonCaseok, it will not case sensitive when the Python import module. |
PYTHONHOME | Another module search path.It usually embedded in the PythonStartup or PythonPath directory, making two modules libraries easier to switch. |
There are three ways to run Python:
$ python # Unix/Linux
Or
C:>python # Windows/DOS
Here are the Python command line parameters:
Option | describe |
---|---|
-d
|
Display debugging information when parsing |
-O
|
Generate an optimized code (
.pyo
File)
|
-S
|
Do not introduce the location of the Python path when starting |
-V
|
Output Python version number |
-X
|
The built-in exception (only for strings only) after the 1.6 version is over time. |
-c cmd
|
Perform a Python script and run the result as a CMD string. |
file
|
Perform a Python script at a given Python file. |
By introducing an interpreter in your application, you can execute Python scripts on the command line, as follows:
$ python script.py # Unix/Linux
Or
C:>python script.py # Windows/DOS
Note: When executing a script, check that the script has executable permissions.