python安装(windows)
1:在官网下载好安装包之后,根据提示默认完成安装,
2:打开环境变量,在path后加上";"+python的安装目录,保存;
3;打开cmd,输入python -V 回车,返回python的版本号,表示python安装成功;
使用python自带的idel学习python
在上一步使用默认安装中有Python34Libidlelibidle.bat,这是python自带的集成开发工具,
找到该文件双击,
输出""hello word"
linux 安装 (centos 7)
1 源代码下载安装
2
3 localhost:~# wget http://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz 4 Resolving www.python.org... done. 5 Connecting to www.python.org[194.109.137.226]:80... connected. 6 HTTP request sent, awaiting response... 200 OK 7 Length: 8,436,880 [application/x-tar] 8 ... 9 localhost:~# tar xfz Python-3.4.3.tgz //解压
10 localhost:~# cd Python-3.4.3
11 localhost:~/Python-3.4.3# ./configure
12 checking MACHDEP... linux2 13 checking EXTRAPLATDIR... 14 checking for --without-gcc... no 15 ... 16 localhost:~/Python-3.4.3# make //此处若出现异常,缺少相应的库
17 gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 18 -I. -I./Include -DPy_BUILD_CORE -o Modules/python.o Modules/python.c 19 gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 20 -I. -I./Include -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c 21 gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 22 -I. -I./Include -DPy_BUILD_CORE -o Parser/grammar1.o Parser/grammar1.c 23 ... 24 localhost:~/Python-3.4.3# make install 25 /usr/bin/install -c python /usr/local/bin/python3.4.3
26 ... 27 localhost:~/Python-3.4.3# exit 28 logout 29 localhost:~$ which python 30 /usr/local/bin/python 31 localhost:~$ python //由于系统中自带了python,所以此处执行的是自带python
32 Python 2.7.5 (#2, Sep 24 2003, 11:39:14) 33 [GCC 3.3.2 20030908 (Debian prerelease)] on linux2 34 Type "help", "copyright", "credits" or "license" for more information. 35 >>> [press Ctrl+D to get back to the command prompt] 36 $ cd /home/lpf/Python-3.4.3/ //绝对路径执行python
$ ./python
Python 3.4.3 (default, Jun 15 2016, 17:23:56)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'hai'
hai
>>> 1+1
2
>>>