Use python in Linux Command Line terminal (recommended), linuxpython
All operations on Linux terminals are performed using the command line. Therefore, for Tom, note several basic command lines and usage methods to quickly use python in the Linux Command Line environment.
Open the command line window
The shortcut for opening the command line window is as follows:
Ctrl + Alt + t
Close command line window
The shortcut for closing the command line window is as follows:
Ctrl + d
Enter the python Environment
Directly input python in the command line to enter the python editing environment. The most obvious prompt after entering the environment is: the cursor from ~ $ Change to >>>.
Exit the python Environment
Use ctrl + d to exit the python environment. Return to the command line environment.
Input Multiple Functions in the python Environment
In the python environment, press enter to end the input and execute the statement. When multiple-line functions are input, enter a line and press enter to directly run a code sentence instead of the entire function block. Therefore, you must be able to wrap a line but not end the input.
Enter English; \ at the end of the statement to implement line feed.
For example:
def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1);\ return tf.Variable(initial);\
Note: Pay attention to indentation when entering function blocks. Otherwise, an IndentationError: unexpected indent python error is reported.
Non-ascii character xe5 in file solution
Cause:Encoding Error in the program. python supports the acii mode by default, but does not support utf8. Therefore, Chinese comments in the program will cause an Error.
Solution: Add # coding: UTF-8 In the first line of the source code file.
The simple method (recommended) for using python in the Linux Command Line terminal is all the content that I have shared with you. I hope to give you a reference and support for the customer's house.