How to install Python libraries under specific environments

前端 未结 3 702
野性不改
野性不改 2021-02-06 18:00

I have two Anaconda installations on my computer. The first one is based on Python 2.7 and the other is based on Python 3.4. The default Python version is the 3.4 though. What i

3条回答
  •  醉酒成梦
    2021-02-06 18:40

    You don't need multiple anaconda distributions for different python versions. I would suggest keeping only one.

    conda basically lets you create environments for your different needs.

    conda create -n myenv python=3.3 creates a new environment named myenv, which works with a python3.3 interpreter.

    source activate myenv switches to the newly created environment. This basically sets the PATH such that pip, conda, python and other binaries point to the correct environment and interpreter.

    conda install pip is the first thing you may want to do. Afterwards you can use pip and conda to install the packages you need.

    After activating your environment pip install will point to the right version of pip so no need to worry too much.

    You may want to create environments for different python versions or different sets of packages. Of course you can easily switch between those environments using source activate .

    For more examples and details you may want to have a look at the docs.

提交回复
热议问题