1. 官方下载安装Anaconda
2. 创建python环境(python2 & python3)
2.1 命令行创建
conda create --name python36 python=3.6
# 创建日志见附录1
conda create --name python27 python=2.7
其他操作
# 激活环境
source activate python36
# 退出环境
source deactivate
# 查看已安装环境
conda info -e
# 删除一个已有的环境
conda remove --name python36 --all
2.2 Anaconda界面创建
Anaconda可视化界面.png 创建python环境.png还可以开启python终端,管理packages等(略)
3. sublime text3 设置
Sublime Text ->Tools -> Build System -> New Build System
python36
{
"cmd": ["/Users/tangkaisky/anaconda3/envs/python36/bin/python3.6", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
python27
{
"cmd": ["/Users/tangkaisky/anaconda3/envs/python27/bin/python2.7", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
创建成功后.png
注意:使用的路径是第2步创建的python环境路径
参考:
Mac下Sublime Text3配置Python开发环境
Mac下用Anaconda创建Python环境
Anaconda使用总结(conda常用操作)
Anaconda多环境多版本python配置指导
附录:
1. 命令行创建python36环境的log
KaideMacBook-Pro:~ tangkaisky$ conda create --name python36 python=3.6
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.2
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: /Users/tangkaisky/anaconda3/envs/python36
added / updated specs:
- python=3.6
The following packages will be downloaded:
package | build
---------------------------|-----------------
xz-5.2.3 | h727817e_4 268 KB
python-3.6.5 | hc167b69_1 15.4 MB
openssl-1.0.2o | h26aff7b_0 3.4 MB
pip-10.0.1 | py36_0 1.8 MB
sqlite-3.23.1 | hf1716c9_0 1.9 MB
setuptools-39.1.0 | py36_0 549 KB
wheel-0.31.0 | py36_0 62 KB
certifi-2018.4.16 | py36_0 142 KB
ca-certificates-2018.03.07 | 0 124 KB
------------------------------------------------------------
Total: 23.7 MB
The following NEW packages will be INSTALLED:
ca-certificates: 2018.03.07-0
certifi: 2018.4.16-py36_0
libcxx: 4.0.1-h579ed51_0
libcxxabi: 4.0.1-hebd6815_0
libedit: 3.1-hb4e282d_0
libffi: 3.2.1-h475c297_4
ncurses: 6.0-hd04f020_2
openssl: 1.0.2o-h26aff7b_0
pip: 10.0.1-py36_0
python: 3.6.5-hc167b69_1
readline: 7.0-hc1231fa_4
setuptools: 39.1.0-py36_0
sqlite: 3.23.1-hf1716c9_0
tk: 8.6.7-h35a86e2_3
wheel: 0.31.0-py36_0
xz: 5.2.3-h727817e_4
zlib: 1.2.11-hf3cbc9b_2
Proceed ([y]/n)? y
Downloading and Extracting Packages
xz 5.2.3: ############################################################## | 100%
python 3.6.5: ########################################################## | 100%
openssl 1.0.2o: ######################################################## | 100%
pip 10.0.1: ############################################################ | 100%
sqlite 3.23.1: ######################################################### | 100%
setuptools 39.1.0: ##################################################### | 100%
wheel 0.31.0: ########################################################## | 100%
certifi 2018.4.16: ##################################################### | 100%
ca-certificates 2018.03.07: ############################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate python36
#
# To deactivate an active environment, use:
# > source deactivate
#
网友评论