安装
下载.sh文件
bash xxx.sh
选择添加环境变量
如果没有添加/home/zhanghao/anaconda3/bin在环境变量
使用pip需要sudo /home/zhanghao/anaconda3/bin pip install tensorflow
卸载
rm -rf xxx(anaconda文件名)
清除环境变量 sudo gedit ~/.bashrc 删除里面的anaconda路径
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
或者手动查看或更改源路径内容
vim ~/.condarc
创建conda虚拟环境
conda create -n xxx python=3.6
source activate xxx
source deactivate xxx
删除环境
在~/.conda/envs/下
conda remove -n xxx --all
使用jupyter notebook:
键入jupyter notebook即可
如果想用在jupyter中使用虚拟环境:
安装虚拟环境时用:conda create -n xxx python=xxx ipykernel
进入该环境:source activate xxx
激活该环境的kernel:python -m ipykernel install --user --name xxx --display-name "xxxxxx"
其实虚拟空间就是你在这里运行python,使用当前目录下的库,包等资源
在jupyter中使用虚拟环境,就是让jupyter找一个文件,就知道在哪里运行python,使用谁的包
上述命令会添加这个文件:
在C:\Users\xxx\AppData\Roaming\jupyter\kernels\xxx中
添加了一个kernel.json
内容一般如下:
{
"language": "python",
"display_name": "xxxxxx",
"argv": [ "D:\\Anaconda3\\envs\\xxx\\python.exe", "-m", "ipykernel_launcher", "-f", "{connection_file}" ]
}