zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    ExcelHelper
    c# 文件的读写
    Wav文件操作类
    c# & (与) 、^ (异或)和 >>(<<位移运算)
    c# 高精度的timer
    c# 生成txt文件,写入内容
    C# 对 list<T>中的数据按某字段的大小进行排序
    OC 底层探索 06、 isa 2个经典问题分析
    OC 底层探索 05、属性、成员、实例变量简析
    数据结构与算法 0、 汇总简介
  • 原文地址:https://www.cnblogs.com/wangkangluo1/p/2338991.html
Copyright © 2011-2022 走看看