初尝python之环境配置
首先,当然是安装python环境
https://www.python.org/downloads/
一开始只安装3.4,但后来发现多数教程都是用2.x写的,玩起来不方便,于是又装上了2.7。兼容不是问题,但运行实验代码时怎么随意切换2.x和3.x?
从一这篇文章上得到启发,在3.4的目录下建立(文章里头是先装2.x,我是先装3.4,所以步骤与文章不一样)一个python2.bat,里面其实是调用2.7下面的python.exe,再把3.4下面的python.exe改名为python3.exe,于是轻松得到这个结果:
C:\Users\Administrator>python3
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
C:\Users\Administrator>python2
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on wi
n32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
下一步,装pychram, http://www.jetbrains.com/pycharm/download/
要注意的是设置python interpreter的时候选择刚才python2.bat或python3.exe