Anaconda conda常用命令

1.升级
升级Anaconda需要先升级conda

conda update conda
conda update anaconda
conda update anaconda-navigator    //update最新版本的anaconda-navigator

2.卸载Anaconda软件

由于Anaconda的安装文件都包含在一个目录中,所以直接将该目录删除即可。删除整个Anaconda目录:

计算机控制面板->程序与应用->卸载 //windows

或者

找到C:\ProgramData\Anaconda3\Uninstall-Anaconda3.exe执行卸载

rm -rf anaconda //ubuntu

最后,建议清理下.bashrc中的Anaconda路径。

conda环境使用基本命令

conda update -n base conda #update最新版本的conda
conda create -n xxxx python=3.5 #创建python3.5的xxxx(名称)虚拟环境
conda activate xxxx #开启xxxx环境
conda deactivate #关闭环境
conda env list #显示所有的虚拟环境
conda info --envs #显示所有的虚拟环境

anaconda安装最新的TensorFlow版本

参考:https://blog.csdn.net/qq_35203425/article/details/79965389
一般从anaconda官网下载的anaconda,查看tensorflow依然还是1.2的版本,现在用conda更新TensorFlow,解决方法:
1.打开anaconda-prompt
2.查看tensorflow各个版本:(查看会发现有一大堆TensorFlow源,但是不能随便选,选择可以用查找命令定位)

anaconda search -t conda tensorflow

3.找到自己安装环境对应的最新TensorFlow后(可以在终端搜索anaconda,定位到那一行),然后查看指定包<USER/PACKAGE>可安装版本信息命令

anaconda show <USER/PACKAGE> 

查看tensorflow版本信息

anaconda show anaconda/tensorflow

4.第4步会提供一个下载地址,使用下面命令就可安装1.8.0版本tensorflow

conda install --channel https://conda.anaconda.org/anaconda tensorflow=1.8.0 

更新,卸载安装包

conda list #查看已经安装的文件包
conda list -n xxx #指定查看xxx虚拟环境下安装的package
conda update xxx #更新xxx文件包
conda uninstall xxx #卸载xxx文件包

5.删除虚拟环境

conda remove -n xxxx --all //创建xxxx虚拟环境

 

6.清理(conda瘦身)
conda clean就可以轻松搞定!第一步:通过conda clean -p来删除一些没用的包,这个命令会检查哪些包没有在包缓存中被硬依赖到其他地方,并删除它们。第二步:通过conda clean -t可以将conda保存下来的tar包。

conda clean -p //删除没有用的包
conda clean -t //tar打包
conda clean -y -all //删除所有的安装包及cache

参考:https://blog.csdn.net/menc15/article/details/71477949

7.重命名env
Conda是没有重命名环境的功能的, 要实现这个基本需求, 只能通过愚蠢的克隆-删除的过程。
切记不要直接mv移动环境的文件夹来重命名, 会导致一系列无法想象的错误的发生!

conda create --name newname --clone oldname //克隆环境
conda remove --name oldname --all //彻底删除旧环境

 

8. 常用软件安装
参考:conda环境下常用软件安装

9.问题
1:failed ERROR conda.core.link:_execute(502):

1 conda install 软件时出现如下错误信息:
2 Preparing transaction: done
3 Verifying transaction: done
4 Executing transaction: 
5 failed ERROR conda.core.link:_execute(502):

解决方法:往往时权限不够,需要以管理员方式运行Anaconda prompt进行安装

2.anaconda或conda不是内部命令
解决方法:https://zhuanlan.zhihu.com/p/32446675

添加上图环境变量即可

jupyter notebook默认工作目录设置
参考:https://blog.csdn.net/liwei1205/article/details/78818568

1)在Anaconda Prompt终端中输入下面命令,查看你的notebook配置文件在哪里:

jupyter notebook --generate-config
#会生成文件C:\Users\用户\.jupyter\jupyter_notebook_config.py

2)打开jupyter_notebook_config.py文件通过搜索关键词:c.NotebookApp.notebook_dir,修改如下

c.NotebookApp.notebook_dir = 'E:\\tf_models' //修改到自定义文件夹

3)然后重启notebook服务器就可以了

**注:**其它方法直接命令到指定目录,Anaconda Prompt终端中输:jupyter notebook 目录地址

欢迎关注公众号:算法工程师的学习日志

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值