Configure python in linux

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.