How to become the Python Saint Warrior's first Python program (1)

Source: Internet
Author: User

  1. Installing the Python Interpreter

    Python is a cross-platform language that currently has 2 of the mainstream. X and 3.X series versions, since the 3.X series is not compatible with the 2.X series, but today many programs and third-party libraries are based on the 2.X series, so we are mainly 2.X, the period will also be interspersed with some of the features of the 3.X. The first step in learning the programming language is helloword!. Then we need to install it first, you can choose to windows,mac,linux any system to learn it.


    Under Windows:

    First, download the latest version 2.7 from python.org, the official website of Python.

    Then, run the download of the MSI installation package, in the selection of the installation components of the step, tick all the components, especially to pay attention to select and, and then all the way pip Add python.exe to Path "Next" to complete the installation. The default installation path is under the C:/python27 directory.

    After the installation is complete:

    Open cmd Command window, enter python-> carriage return, you can enter the Python command line smoothly.

    If the error indicates that Python is not an internal or external command, is not a running program or batch file, and that Python does not include system variables, you need to manually set the system variables: My Computer –> Right-click Properties –> Advanced System settings –> environment variables > System variable –> Select the variable named path, click Edit –> Variable Value (V): plus; and installation path, such as; C://python27. Then enter the above statement.


    Under Linux:

    If you use Linux, you should have the ability to install the software. The CentOS system comes with version 2.6 or 2.7 and you can upgrade it yourself. Suppose we install the directory that is:/usr/local/python2.7

    Also you need to add the Python path to the system environment variable:

    In/etc/profile, add our Python path to the end of path:

    Export/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin/:/usr/local/python/bin

    Then execute Source/etc/profile

    Or use a soft connection such as: Ln-s/usr/local/python2.7/usr/bin/python can be.


    Under Mac:

    If you are using a Mac, the system is OS X 10.8 or the latest 10.9 Mavericks, congratulations, the system comes with Python 2.7. If your system version is below 10.8, you can get Python 2.7 by backing up your system and upgrading to the latest 10.9 for free.



  2. Implement Helloword:

    Enter in the interpreter: print "Hello World" executes a carriage return to see the output, so we implement the first Python program, you can also use single quotation marks, enclosed quotation marks and double quotation marks in the content we call the string, which is a basic most common data type, We will also learn other types of data in the future.

    (If you are in the PYTHON3 environment you should enter print ("Hello World"))

This article is from the "linux-saints" blog, please be sure to keep this source http://fangqi.blog.51cto.com/10856791/1972989

How to become the Python Saint Warrior's first Python program (1)

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.