Python Learning notes----01, Python Installation

Source: Internet
Author: User

Python installation Windows
1234567 1、下载安装包    https://www.python.org/downloads/2、安装    默认安装路径:C:\python273、配置环境变量    【右键计算机】--》【属性】--》【高级系统设置】--》【高级】--》【环境变量】--》【在第二个内容框中找到 变量名为Path 的一行,双击】 --> 【Python安装目录追加到变值值中,用 ; 分割】    如:原来的值;C:\python27,切记前面有分号

Linux, Mac

123 无需安装,原装Python环境 ps:如果自带2.6,请更新至2.7

  

V. Hello World Program

Create a file under Linux called hello.py, and enter

1 print("Hello World!")

Then execute the command: Python hello.py, output

123 localhost:~ lei$ vim hello.pylocalhost:~ lei$ python hello.pyHello World!

Specify interpreter

When executing Python hello.py in the previous step, it is clear that the hello.py script is executed by the Python interpreter.

If you want to execute a python script like executing a shell script, for example, you ./hello.py  would need to specify the interpreter at the head of the hello.py file, as follows:

123 #!/usr/bin/env python print"hello,world"

So, execute:. /hello.py Can.

PS: Need to give hello.py execute permission before execution, chmod 755 hello.py

Executing in the interactive device

In addition to writing the program in the file, you can also call the Python's own interactive running code,

123456 localhost:~ lei$ pythonPython 2.7.10(default, Oct23201518:05:06)[GCC 4.2.1Compatible Apple LLVM 7.0.0(clang-700.0.59.5)] on darwinType"help""copyright""credits"or"license" formore information.>>> print("Hello World!")Hello World!

Python Learning notes----01, Python Installation

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.