windows下 python的安装配置

装:
下载,从这里下载:http://python.org/download/
下载windows版本,下载完成以后,双击打开,然后一步一步安装。
    *Python 2.5.2 Windows installer
     下载地址:
http://python.org/ftp/python/2.5.2/python-2.5.2.msi  
115:python
          (Windows binary -- does not include source)
装好后,启动 Python command line,然后输入:print "Hello World"
如果输出"Hello World",那就表明安装成功了。
简单的配置:
右键我的电脑-属性-高级-环境变量,在path里输入你的python安装位置即可,比java简单的多了。
我的是 E:\Python25;应该是找到pythonw.exe的父一级目录。
测试:
随便建一个文件夹,如在d\code\python下建立一个文本文件,并改名为 hello.py
在文本中输入
print "Hello World"
在命令提示符下进入到 d\code\python路径下
1、输入python hello.py
2、直接输入hello.py (必须设置环境变量才可以)
程序将会输出Hello World
我们看另一个稍微复杂的程序:
integer1=raw_input("enter the first integer:\n")
integer1=int(integer1)
integer2=raw_input("enter the second integer:\n")
integer2=int(integer2)
sum=integer1+integer2
print "The sum is ",sum

另存为sum.py .
(注:raw_input是内建函数要求用户输入。integer1=int(integer1)将integer1转换成整型。)
执行结果为:
E:\>python  e:\python\sum.py
enter the first integer:
8
enter the second integer:
11
The sum is  19

原文地址:https://www.cnblogs.com/wangkangluo1/p/2338991.html