1.首先得使用(这个是必须条件)
2.下载:anaconda
下载网址:https://www.continuum.io/downloads#osx
我选的:COMMAND-LINE INSTALLER (375M)
下载完:Anaconda2-4.4.0-MacOSX-x86_64.sh
打开终端:进入Anaconda2-4.4.0-MacOSX-x86_64.sh所在目录
$ chmod 777 ./Anaconda2-4.4.0-MacOSX-x86_64.sh //给执行的脚本添加执行权限
Do you approve the license terms? [yes|no]
>>> yes
Anaconda2 will now be installed into this location:
/Users/mac/anaconda2
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/Users/mac/anaconda2] >>> /Users/mac/Desktop/工具/anaconda2
这里执行报错,最后会报不支持中文路径,改成如下,在执行:
[/Users/mac/anaconda2] >>> /Users/mac/Desktop/Tool/anaconda2
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
....
A Python library which exposes cryptographic recipes and primitives.
Do you approve the license terms? [yes|no]
>>>
>>> yes
installation finished.
Do you wish the installer to prepend the Anaconda2 install location
to PATH in your /Users/mac/.bash_profile ? [yes|no]
[yes] >>> yes
Prepending PATH=/Users/mac/Desktop/Tool/anaconda2/bin to PATH in /Users/mac/.bash_profile
A backup will be made to: /Users/mac/.bash_profile-anaconda2.bak
For this change to become active, you have to open a new terminal.
Thank you for installing Anaconda2!
Share your notebooks and packages on Anaconda Cloud!
Sign up for free: https://anaconda.org
注意此时无法使用普通用户运行spyder(为什么?如何修改?)
[liuyao@localhost ~]$ spyder
bash: spyder: 未找到命令...
找不到这个使用如下安装:
If you already have a working installation of numpy and scipy, the
easiest way to install scikit-learn is using pip
pip install -U scikit-learn
or conda:
命令行如下:
conda install scikit-learn
Requirement already up-to-date: scikit-learn in ./Desktop/Tool/anaconda2/lib/python2.7/site-packages
执行命令:
MacBook-Pro-4:~ mac$ spyder
2017-06-11 07:11:08.965 python[19990:1582283] IMKClient Stall detected, *please Report* your user scenario attaching a spindump (or sysdiagnose) that captures the problem - (imkxpc_bundleIdentifierWithReply:) block performed very slowly (3.34 secs).
这时候我们看到 spyder已经run起来了:上面用到了:pip这个命令,这个也是一个工具集,是需要安装的:
参考:http://blog.csdn.net/jobschen/article/details/49559023sudo easy_install pip
… …
…此处省略N行…
… …
Installed /Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg
Processing dependencies for pip Finished processing dependencies for
pip
里面包括了pip,以及spyder的简介。
现在我们在spyder里执行下看我们的机器学习3个主要的庫有带吗?
看都有带,那现在环境算是安装好了。
1. Spyder和anaconde
这两个是孪生兄弟,可以说在anaconda官网上下载,安装好anaconde之后,就已经安装好了
Spyder,不得不说,anaconda一次性下载了很多常用的python包,而且对于包管理也很方便。但是,Anaconda不是
IDE,Spyder是一个IDE,也是我第一个用的python相关的IDE,可是发现调试程序的时候,有很多变量他都不会显示,例如self等,这让
人在debug的时候很痛苦。
2. Pycharm
很强大的python
IDE,上手很快(Spyder同样也上手快),最深刻的体验是,所以的变量都能显示,方便调试,里边还有ipython
notebook,终于不用切换到浏览器中用notebook做实验了。现在一直再用它了,没有用别的IDE。PS.
看到有人在评论区说它运行速度有点慢,我只在Linux下用过,i5, 8G内存,启动的时候稍微有点慢,但是正常运行的时候一点都不慢。
那如果想用Pycharm结合Anaconda使用呢?
How to set up an IDE to use Anaconda 设置某IDE使用Anaconda(也是在Anaconda官方文档上)
包括:
这里就简单为不想看英文的说一下PyCharm的配置
PyCharm’s Preferences -> Project Interpreter -> Add local -> 选择Anaconda安装所在的文件下的bin/python
apply -> OK
参考:http://blog.csdn.net/muzilanlan/article/details/50479931
那么不想用anaconda怎么办呢?
卸载anaconda:https://docs.continuum.io/anaconda/install#uninstall-anaconda