Tanmay Bhatnagar
Tanmay Bhatnagar

Reputation: 2470

Setup a virtual environment for pip work and conda work

OS - Ubuntu 16.04 LTS

I want to setup my machine so I have two virtual environments

  1. For pip
  2. For conda

I want to do this so in one virtual environment I can have all libraries that are installed using pip and in the other I can have all my anaconda work/libraries

For pip and conda both I want to a have Python3.6 as default

How can I do this ?

Upvotes: 0

Views: 149

Answers (1)

merv
merv

Reputation: 76780

First, install Miniconda. You can then create an environment where you (try to) only use conda

> conda create -n conda_only python=3.6
> conda install -n conda_only numpy ...

And you can also make your 'pip' environment as a conda env, but then only use pip to install packages. For example,

> conda create -n pip_only python=3.6 pip
> source activate pip_only
> pip install numpy ...

I don't know your motivation (benchmarking installation times perhaps?), but it should be noted that in practice it's common to mix conda and pip simply because some packages are only on PyPI. Plus, conda recognizes packages installed by pip.

Upvotes: 1

Related Questions