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

推荐订阅源

D
Docker
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Check Point Blog
The GitHub Blog
The GitHub Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
博客园_首页
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
T
The Blog of Author Tim Ferriss
The Cloudflare Blog

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#