conda虚拟环境
conda常用命令
python单环境经常会因为包冲突问题导致无法正常工作,用conda可以很好的隔离开发环境
conda upgrade --all
conda update packagename
conda install packagename
conda installl numpy pandas scipy
conda install numpy =1.10
conda remove packagename
conda list
更新conda主程序
conda update conda
conda update anaconda
conda update anaconda-navigator
Anaconda代理访问源(实测不管用)
conda config --set use_pip True
执行完上述命令之后,当前用户的home目录下会出现一个
.condarc
文件
将下列内容粘贴到该文件中
proxy_servers:
socks5 127.0.0.1 51837
Anaconda仓库第三方源
参考: 可以使用其他国内源
在系统用户目录下创建名为 `.condarc` 的文件
touch ~/.condarc
然后将下面内容复制到
.condarc
文件中
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
清除索引缓存(必需执行)
创建虚拟环境
conda create -n 环境名 python=3.6
conda create -y --name wes python=3.8
conda create -n your_env_name python=3.5 numpy pandas
管理python环境:
conda activate env_name
conda deactivate env_name
conda remove -n 环境名 --all
conda info -e
conda env list
powershell下无法激活conda虚拟环境
执行命令
重启powershell,如果出现命令行前出现(base)即为成功
如果报错,请参考 https://www.jianshu.com/p/4e6d00d55506
powershell无法退出conda虚拟环境
错误的命令
正确执行命令
卸载conda后powershell报错
参考地址:
https://blog.raincorn.top/2020/02/21/Anaconda_Uninstalled_CMD_Powershell_Error/
暂时没好的解决办法,重新安装anaconda执行
conda init
就好了