Anaconda
Anaconda 为python版本控制工具,分为linux和windows版本,可以同时安装python2和python3版本,使用时激活对应版本即可。
linux
在清华大学镜像源找到需要下载的链接
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=N&O=D
在linux中使用wget下载
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.05-Linux-x86_64.sh
安装命令
bash Anaconda3-2021.05-Linux-x86_64.sh
收到如下信息
Welcome to Anaconda3 2021.05
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
按enter继续,一直向下
Last updated April 5, 2021
Do you accept the license terms? [yes|no]
[no] >>>
输入yes
Anaconda3 will now be installed into this location:
/root/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/anaconda3] >>>
输入enter,默认安装,会花费一定时间
Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>>
输入yes,以便无需手动将Anaconda添加到PATH
Thank you for installing Anaconda3!
===========================================================================
Working with Python and Jupyter notebooks is a breeze with PyCharm Pro,
designed to be used with Anaconda. Download now and have the best data
tools at your fingertips.
PyCharm Pro for Anaconda is available at: https://www.anaconda.com/pycharm
安装完毕,然后激活安装
source ~/anaconda3/bin/activate
查看是否安装成功
conda --version
conda 4.10.1
更改conda源(后续安装第三方库可以加快速度)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
查看是否修改好通道:
conda config --show channels
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
创建python环境
conda create --name env_name python=py_version
conda create --name py37 python=3.7
conda create --name py27 python=2.7
查看安装环境
conda info -e
# conda environments:
#
base * /root/anaconda3
py27 /root/anaconda3/envs/py27
py37 /root/anaconda3/envs/py37
激活使用环境
conda activate py27
退出环境
conda deactivate
删除环境
conda remove --name env_name --all
windows
安装时Add Anaconda to the system PATH environment variable 一定选上,可以不用手工配置环境
安装后问题
安装miniconda系统后,运行cmd闪退,是由于勾选了创建系统环境变量所导致,需要修改注册表
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun中有一个if exit 的值,删除该值,保存后退出,尝试再次运行cmd,会正常调用cmd