用Conda创建Python虚拟环境
Step1:下载安装Anaconda
https://www.anaconda.com/distribution/#download-section
Step2:打开Anaconda Prompt
开始 -> 搜索Anaconda Prompt -> 打开
image.png
输入 conda --version
确认 conda 已安装
Step3:创建虚拟环境
conda create -n [your_env_name] python=[x.x] anaconda
e.g. conda create -n ml python=3.7 anaconda
Step4:进入虚拟环境(activate)
conda activate [your_env_name]
e.g. conda activate ml
Step5:在虚拟环境中安装所需的Python包
查看已有的包:
pip list
安装所需的包:
conda install -n yourenvname [package]
或者
pip install [package]
e.g. conda install -n ml pandas
or pip install pandas
Step6:退出虚拟环境(deactivate)
conda deactivate
删除虚拟环境
conda remove -n [your_env_name] -all
Reference: https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/
网友评论