How to create conda environment with specific python version? How to create conda environment with specific python version? python python

How to create conda environment with specific python version?


You need to install ipython as well into your given environment

conda create -n "myenv" python=3.3.0 ipython

The conda environments are prepended to your PATH variable, so when you are trying to run the executable "ipython", Linux will not find "ipython" in your activated environment (since it doesn't exist there), but it will continue searching for it, and eventually find it wherever you have it installed.


To create an environment named py33 with python 3.3.0, using the channel conda-forge and a list of packages:

conda create -y --name py33 python==3.3.0conda install -f -y -q --name py33 -c conda-forge --file requirements.txtconda activate py33...conda deactivate

Alternatively you can create an environment.yml file instead of requirements.txt:

name: py33channels:  - conda-forgedependencies:  - python=3.3.0  - ipython

Use this command to remove the environment:

conda env remove -n py33


I had similar issue. And I could't find many useful discussions.

The problem for me was I have alias pointing python to miniconda python hardcoded in my shell config file when I execute conda init zsh. Somehow the init process copies the alias and always reload that, thus overwrites the "correct" version.

After conda create -n py27 python=2.7 (my system default is 3.6), the version was correctly installed at miniconda3/envs/py27/bin/python. But the activated evironment python was not pointing to it, as indicated by which python,even if I deleted updated my shell config.

In the end it was solved by 'reverse' conda init (remove the generated conda function in .zshrc), remove alias, and re-init.

I guess other shell is using the same mechanism.