安装
Linux安装
Anaconda是最受欢迎的python数据科学和机器学习平台,用于大规模数据处理,预测分析和科学计算。Anaconda发行版附带了1,000多个数据包,conda命令行工具和Anaconda Navigator的桌面图形用户界面。一般而言,使用Anaconda比直接使用官方的python更好用。
本教程将指导您完成在Ubuntu 18.04上下载和安装Anaconda Python Distribution。通常也适合多数其他Linux。
下载Anaconda
https://www.anaconda.com/download/#linux
在撰写本文时,Anaconda的最新稳定版本是5.3版本。
![859](https://i-blog.csdnimg.cn/blog_migrate/4f693a269d71d531dd470a8e4ad15350.webp?x-image-process=image/format,png)
请选择64-Bit (x86) Installer 进行下载,尽量不要用python2.7,很多库已经不提供python2.7支持。
点击链接就会进行下载,同时会弹出信息收集框,直接关闭就好。
![671](https://i-blog.csdnimg.cn/blog_migrate/904b0cf736907f4944fc3fdbb3d14f3f.webp?x-image-process=image/format,png)
安装Anaconda
$ sudo sh Anaconda3-5.3.0-Linux-x86_64.sh
[sudo] andrew 的密码:
Welcome to Anaconda3 5.3.0
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>> # 按下回车
... # 多次按空格读完license。
Do you accept the license terms? [yes|no]
[no] >>> yes # 输入yes
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
...
[/home/andrew/anaconda3] >>> /usr/local/anaconda3 # 输入自定义目录
... # 安装根据机器性能,通常需要持续几分钟。
# 讨论 钉钉群21745728 qq群144081101 567351477
# 本文地址:https://www.jianshu.com/p/9fe9ff999234
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no] #选择no,一般来说自带的spyder和专业IDE wingIDE更好用。
...
Do you wish the installer to initialize Anaconda3
in your /home/andrew/.bashrc ? [yes|no]
[no] >>> # 选择yes
Initializing Anaconda3 in /home/andrew/.bashrc
A backup will be made to: /home/andrew/.bashrc-anaconda3.bak
For this change to become active, you have to open a new terminal.
Thank you for installing Anaconda3!
===========================================================================
Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined
code editor with support for development operations like debugging, task
running and version control.
To install Visual Studio Code, you will need:
- Administrator Privileges
- Internet connectivity
Visual Studio Code License: https://code.visualstudio.com/license
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>> no
添加“export PATH=/usr/local/anconda3/bin:$PATH“ 到/etc/profile,这样所有用户都可以使用Anaconda python3.7了。
上面的.bashrc在刚才安装时添加了如下内容:
# added by Anaconda3 5.3.0 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/usr/local/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/usr/local/anaconda3/etc/profile.d/conda.sh" ]; then
. "/usr/local/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/usr/local/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup~/.bashrc
# <<< conda init <<<
验证安装
通过重新登陆或者执行'source ~/.bashrc"加载环境变量。
$ conda info
active environment : base
active env location : /usr/local/anaconda3
shell level : 1
user config file : /home/andrew/.condarc
populated config files :
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
base environment : /usr/local/anaconda3 (read only)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/linux-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /usr/local/anaconda3/pkgs
/home/andrew/.conda/pkgs
envs directories : /home/andrew/.conda/envs
/usr/local/anaconda3/envs
platform : linux-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Linux/4.15.0-36-generic ubuntu/18.04 glibc/2.27
UID:GID : 1000:1000
netrc file : None
offline mode : False
$ python
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
至此,已经安装完毕。
更新Anaconda
一般是有新版本发布时才需要使用。
$ conda update conda
$ conda update anaconda
删除Anaconda
一般是有新版本发布时才需要使用。
$sudo rm -rf /usr/local/anaconda3
删除上面~/.bashrc和/etc/profile的修改
清空隐藏文件: rm -rf ~/.condarc ~/.conda ~/.continuum
参考资料
- 讨论qq群144081101 591302926 567351477 钉钉免费群21745728
- 本文最新版本地址
- 本文涉及的python测试开发库 谢谢点赞!
- 本文相关海量书籍下载
- https://linuxize.com/post/how-to-install-anaconda-on-ubuntu-18-04/
Windows安装
下载,比如:https://repo.anaconda.com/archive/Anaconda3-5.3.0-Windows-x86_64.exe
执行:
![499](https://i-blog.csdnimg.cn/blog_migrate/5eac925a4db1797b4ec277309022b392.webp?x-image-process=image/format,png)
![499](https://i-blog.csdnimg.cn/blog_migrate/e2a9fd22463830ad104313f67a73375b.webp?x-image-process=image/format,png)
![499](https://i-blog.csdnimg.cn/blog_migrate/590645063c34d61a3bde57b9540dcc5f.webp?x-image-process=image/format,png)
![499](https://i-blog.csdnimg.cn/blog_migrate/7dc64368a853f4fe9d128297c6df20d1.webp?x-image-process=image/format,png)
![499](https://i-blog.csdnimg.cn/blog_migrate/a6e94a503825741d570b5a4f437932d4.webp?x-image-process=image/format,png)
上面红色的部分一定要选中,这样会帮你自动配置环境变量。
![499](https://i-blog.csdnimg.cn/blog_migrate/69debaad15afc3cfa6d484d4fd089139.webp?x-image-process=image/format,png)
![499](https://i-blog.csdnimg.cn/blog_migrate/49c34dc0c206ba7546f209a2fa5d2089.webp?x-image-process=image/format,png)
![499](https://i-blog.csdnimg.cn/blog_migrate/c08c10dbf7263b407b9da1b475e8cd6d.webp?x-image-process=image/format,png)
![499](https://i-blog.csdnimg.cn/blog_migrate/1c216c89c0c7d8a68435d01f18cfca10.webp?x-image-process=image/format,png)
新开cmd,输入python
![859](https://i-blog.csdnimg.cn/blog_migrate/7773d1618de526e64d28cb7f4643b269.webp?x-image-process=image/format,png)
命令行输入spyder
![1000](https://i-blog.csdnimg.cn/blog_migrate/aa1dc40e278d16d5563d032a5f1d387f.webp?x-image-process=image/format,png)
wingide
![1000](https://i-blog.csdnimg.cn/blog_migrate/95580d6df8d56e495d0e484bcc2a4cdf.webp?x-image-process=image/format,png)
MAC安装
MAC的安装和Windows类似。