Python
安装和配置环境变量
一、
Python
的安装:
在网上找一个
python
的安装包,我找的
python3.3.5
。照着安装步骤一步一步进行安装,完
成后,运行
IDLE(Python GUI)
,打开的命令行框出现类似如下内容则说明安装成功:
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar
9 2014, 10:37:12) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
可以试试经典的
hello world
,注意不同
python
版本的语法不同。
>>>print("Hello world")
Hello world
>>>
二、配置
python
环境变量
安装完
Python
后并不会自动配置环境变量。
配置环境变量之前,
在
cmd
命令行下运行
python
是无效的,为了方便将来安装其它
python
模块,需要配置一下环境变量。
配置方法:右键计算机
--
属性
--
高级
--
环境变量,在系统变量中找到
PATH
,编辑此变量,在
最后加上
python
的安装目录。我的安装目录是
D:\Program
Files\Python33
,就在
PATH
变量
最后加上“
;D:\Program
Files\Python33
”
,注意每个路径之间要用英文分号
;
隔开。保存后打
开
cmd
命令行试试:
C:\Users\Administrator>python -V
Python 3.3.5
如果想要直接在
cmd
命令行下运行
python
文件,还需要配置
PATHEXT
变量,同样在刚才的
位置找到
PATHEXT
系统变量,编辑它,在最后加上“
;.PY;.PYM
”即可,也要注意用英文分号
隔开每个后缀名。
至此
Python
环境变量配置完毕,在
cmd
命令行直接输入
python
也可以编写
python
:
C:\Users\Administrator>python
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar
9 2014, 10:37:12) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>