惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
F
Fortinet All Blogs
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
爱范儿
爱范儿
美团技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
有赞技术团队
有赞技术团队
博客园_首页
T
The Blog of Author Tim Ferriss
T
Tailwind CSS Blog
V
Visual Studio Blog
Jina AI
Jina AI
博客园 - Franky
量子位
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
aimingoo的专栏
aimingoo的专栏
M
MIT News - Artificial intelligence

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
Virtual Environment Management with Conda
2020-06-11 · via jdhao's digital space

Conda is the default package and environment management tool shipped with Anaconda.

This post logs my cheatsheet and notes for working with virtual environments with conda.

commonly used commands for virtual env#

  • Create a new environment: conda create -n my_env
  • List environments on the system: conda env list
  • Delete an environment: conda env remove -n my_env
  • Activate an env:
    • Windows: conda activate my_env
    • Mac/Linux: source activate my_env
  • Exit/quit an env:
    • Windows: conda deactivate my_env
    • Mac/Linux: source deactivate my_env

How to install packages into a specific environment?#

Outside an env, we can use the -n option to specify which environment we want to install packages into:

conda install -n my_env -c some_channel some_package

If we are inside the virtual environment, there is no need to use the -n option. We can install a package with conda install.

Remove package in an env#

Remove pakcage from an env: conda remove -n my_env some_package. If you do not specify -n, some_package in current env will be removed. If you are not in any virtual env, some_package in the global Python path will be removed.

Using pip inside env install packages to global site-package location?#

When I am inside a virtual env, I am surprised that pip install some_package installs the package to the global site-package instead of inside the virtual env.

After some digging, I find that reason is that I was not using the pip command inside that virtual environment. To check this, use the following command before using pip install:

If the pip path is not inside the virtual env, then we are using the system-wide pip. So pip install some_package will install some_package into to global Python path instead of the virtual environment.

References#