1、安装mysql-python
- 环境:OS X Yosemite10.10.2 + Python2.7
 
- 首先网上搜了下mysql-python,说要先安装mysql客户端,然后改配置文件,可是各种改和配置,折腾两天还是报错。后来网上搜到用brew安装,快速搞定。步骤如下:
 
    先把之前装的卸载干净:
    pip uninstall mysql-python
    brew uninstall mysql-connector-c
    安装
    brew install mysql-connector-c
    pip install mysql-python
- 测试是否安装成功,在终端输入命令,无报错即安装正确。
 
    sh-3.2# python
    Python 2.7.6 (default, Sep  9 2014, 15:04:36)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    >>>
2、 安装pycharm
- 直接在jetbrains官网上下载profession版安装,然后网上很多破解码。。。下载profession版的原因是profession版可直接新建django项目,我在后面会安装并用到django。
 
3、Django安装
4、环境测试
![]()
- 选择django,即可新建django项目,选择python解释器的路径:python2.7。点击新建即可完成创建。
 
![]()
![]()
- 配置web启动项。点击run旁边的配置edit configuration进入配置页
 
![]()
![]()