开发环境
- 系统:Mac OSX 10.14.4
- python 安装工具 :Anaconda
安装Anaconda
- 下载Anaconda,从官网下载地址,建议下载可视化安装工具,64-Bit Graphical Installer (624 MB)版,安装比较简单
搭建python环境
#创建环境
conda create --name py27 python=2.7
#激活环境
source activate py27
#退出激活
source deactivate
#删除一个已有的环境
conda remove --name py27 --all
#查看已有的环境
conda info -e
# 安装scipy
conda install scipy
# 查看已经安装的packages
conda list
# 查看某个指定环境的已安装包
conda list -n py27
# 查找package信息
conda search numpy
# 安装package
conda install -n py27 numpy
# 如果不用-n指定环境名称,则被安装在当前活跃环境
# 也可以通过-c指定通过某个channel安装
conda install -n py27 -c http://xxxxxxx numpy
# 更新package
conda update -n py27 numpy
# 删除package
conda remove -n py27 numpy
# 更新python
conda update python
# 添加清华镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
- 我们创建的python环境会在Anaconda的envs录下:

PyCharm 使用指定的python环境
- 创建python工程,选择我们上面创建的python环境,状态栏->PyCharm->Prefenerces, 如下图:

- 添加我们上面创建的python环境,如下图:

- 选择已存在的环境

- 选择我们上面创建的py27
