close

How to create conda environment with specific python version?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to create conda environment with specific python version in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to create conda environment with specific python version?

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

    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.

  2. create conda environment with specific python version

    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.

Method 1

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.

Method 2

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.0
conda install -f -y -q --name py33 -c conda-forge --file requirements.txt
conda activate py33
...
conda deactivate

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

name: py33
channels:
  - conda-forge
dependencies:
  - python=3.3.0
  - ipython

Use this command to remove the environment:

conda env remove -n py33

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read