Loading... ## 创建一个新环境: ```shell conda create -n your_env_name python=X.X # 或 conda create --name your_env_name python=X.X ``` **-n即--name,your_env_name是你自定义的环境名称。** ### 例如: ```shell conda create -n newenv python=3.7 # python=3.7会安装最新的python3.7系列版本(如3.7.12) # 如要指定更详细的版本,需使用python=3.7.2 ``` ## 激活某个环境 **激活,activate。即进入某个环境。** ### Windows系统: ```shell activate your_env_name ``` ### Linux系统: ```shell source activate your_env_name ``` ## 包的安装和删除、环境删除 ### 安装包: ```shell conda install [package] # 如:conda install numpy # 指定包版本:conda install xlrd=1.2.0 (注意是单等于号) # 也可以使用pip install安装 pip install xlrd==1.2.0 (注意是双等于号) # 查看可用的版本:pip install spyder==* ``` ### 删除当前环境中的某个包: ```shell conda remove [package] # 请注意:并非conda uninstall # pip指令下才有 pip uninstall ``` ### 升级某个包: ```shell conda update [package] # conda update --all 升级所有包 ``` ### 退出当前虚拟环境: ```shell source deactivate # Linux环境 deactivate # Windows环境 ``` ### 删除某个虚拟环境: ```shell conda remove -n your_env_name --all # -n即--name ``` ### 复制某个虚拟环境: ```shell conda create --name new_env_name --clone old_env_name ``` ## 环境查询 ### 查看安装了哪些包: ```shell conda list ``` ### 查看当前有哪些虚拟环境: ```shell conda env list # 或 conda info --envs ``` ### 查询环境python版本: ```shell python --version ``` ### 查询conda版本: ```shell conda --version ``` ### 更新conda: ```shell conda update conda ``` ### 查看conda环境详细信息: ```shell conda info ``` 最后修改:2022 年 05 月 17 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果文章有用,请随意打赏。