To learn python in Linux, first install the Linux system. Most Linux systems have Python interpreters.
1. Enter python in the Command window of the Linux system to test whether to install python. If Python has been installed, the following information will appear.
If the prompt is-Bash: Python: Command not found, python is not installed.
2. Install Python
To install the software, enter the root permission, enter Su to switch to the root permission, enter apt-Get install python, and press enter to complete the python installation.
3. Install the editor Vim
If Vim is not installed in your system, follow the 2. Install Python method to install vim, that is, enter apt-Get install Vim under the root permission.
4. After the above three steps, you can use Vim to compile python. Press Ctrl + D to exit the root permission. The following example uses Vim to write a Python code and test it.
Input
Vim test. py // create the python file test. py and go to the vim editor.
In the vim Editor, press the I key to enter the file insertion status. Now you can write python in the vim editor. Write the following code,
Then Press ESC to exit the insert status,
Enter (: WQ !) Press enter to save the test. py file and exit vim.
Enter Python test. py as follows and press enter to get the running result.