Python 下载 安装
下载页面 : https://www.python.org/downloads/release/python-2714/
下载 : Windows x86-64 MSI installer 2.7.14
环境变量
如果你在安装的时候勾选了 "install python.exe to path",类似于这样的选项,一般不用设置环境变量,不过可以再检查一下。
这里假如安装在 K:\Python\Python27
目录下,需要设置 K:\Python\Python27
和 K:\Python\Python27\Scripts
到环境变量 PATH 中。
执行 python -h
查看是否安装成功
pip 安装
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4 binaries downloaded from python.org, but you'll need to upgrade pip.
如果你安装的 Python 版本大于 >=2.7.9
或者 >=3.4
,pip 自带的,
如果不是,请参考以下安装(更新)文档 pip Installation
执行 pip help
查看是否安装成功(建议在 PowerShell 下或者 git bash 下执行)
MySQLdb 安装
pip install mysql-python
异常处理
error: Microsoft Visual C++ 9.0 is required
根据提示 访问 http://aka.ms/vcpython27 下载包安装
fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
- 安装 wheel :
pip install wheel
- 下载 64位的 MySQL-Python: https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
- 安装
.whl
文件 :pip install MySQL_python-1.2.5-cp27-none-win_amd64.whl
IDE
这里建议使用 Jetbrains 开发 PyCharm,下载地址 http://www.jetbrains.com/pycharm/download/
下载免费的 社区版(Community)就足够用了。