I. Modifying the Python version of Linux
Use commands to view Python versions
ls/usr/bin/python*
View the default Python version information
Python--version
1. User-modified version of Python
To modify a Python version for a specific user, simply create an alias in its home directory. Open the user's ~/.BASHRC file and add
Alias python='/usr/bin/python3.4'
Effective: Reload. BASHRC $. ~/.bashrc
2. Download the new Python
(1). Download the source package,,https:
/
/
www.python.org
/
ftp
/
python
/
(2). Unzip and enter the source file
(3). Compile and install
./configure
Make all
Make install
(4). View version
/usr/local/bin/python2.7-v
(5). Modify the default Python version
mv
/
usr
/
bin
/
python
/
usr
/
bin
/
python2.
6
ln
-
s
/
usr
/
local
/
bin
/
python2.
7
/
usr
/
bin
/
python
Two. HelloWorld python internal implementation process Python internal execution process is as follows: (1). Executing a python file if you call to another file, the __pycache__ folder is created in the current directory to hold the PYc file. (2). The interpreter is added at the top of the
#!/usr/bin/env python
(3). Content Encoding (PY2)
At the top of the py2, you need to add the following:
#-*-coding:utf-8 -*-
However, the py3 is brought into the input by default
Getting Started with Python (i)