In fact, it is very easy to configure python in linux.
1. Check whether python has been installed on your linux server.
Enter the following command line:
Python-V
If the version information is displayed, it indicates that python has been installed on your machine.
Otherwise, install python as follows.
2. Enter the following command line:
Sudo apt-get install python
3. test whether the installation is successful.
Enter:
Python
The following results are displayed:
Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Enter
Print 'Hello world'
If hello world is printed, it indicates that python is successfully installed.
4 Note: The python installed in this method is generally in the/usr/bin directory.
Python script porting between different linux machines
Pay attention to path issues.
The installation path of python may vary with linux machines. When porting a script, modify the bin path.
That is, to modify the first line of the script ,#! /Usr/bin/python may need to be modified
Use of python files.
1. Open a file named job. py in linux
2. Write down the content:
#! /Usr/bin/python # This is the python installation path
# Coding = UTF-8
Print "Hello, word ."
3. Save
4. Change the file format sudo chmod + x job. py
5. Execution file./job. py
This article is from the "Security_net" blog, please be sure to keep this http://yxh1157686920.blog.51cto.com/7743046/1303616