{"id":58277,"date":"2024-01-30T13:56:20","date_gmt":"2024-01-30T13:56:20","guid":{"rendered":"https:\/\/www.askpython.com\/?p=58277"},"modified":"2025-04-10T20:42:06","modified_gmt":"2025-04-10T20:42:06","slug":"conda-environment-specific-python-version","status":"publish","type":"post","link":"https:\/\/www.askpython.com\/python\/examples\/conda-environment-specific-python-version","title":{"rendered":"Conda Environment Creation with Specific Python Versions [Step-by-Step]"},"content":{"rendered":"\n<p>Creating a conda environment with a specific Python version is common in various fields like data science and machine learning, scientific computing, and bioinformatics. It ensures the compatibility and consistency of the project. Different projects or applications may have dependencies on a particular version of Python. Creating a conda environment with a defined Python version helps avoid unexpected errors or issues related to version dependencies.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is Conda?<\/h3>\n\n\n\n<p>Conda is an open-source package management system and environment management system. It is widely used for installing, updating, and managing software packages and their dependencies. Conda is widely used in data science and machine learning fields due to its ability to handle library dependencies effectively. Conda allows the creation of different environments.<\/p>\n\n\n\n<p><em>Also read: <a href=\"https:\/\/www.askpython.com\/python\/examples\/check-anaconda-version-on-windows\" data-type=\"post\" data-id=\"53005\">Check Anaconda Version on Windows 10 [4 Easy Methods]<\/a><\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step &#8211; Creating a Conda Environment with a Specific Python Version<\/h2>\n\n\n\n<p>Here we are using an &#8216;<strong>Anaconda navigator<\/strong>&#8216;.  It is used for launching and managing conda packages and environments.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you haven&#8217;t installed Conda yet, download it from the official website &#8211; <em><a href=\"https:\/\/www.anaconda.com\/download\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.anaconda.com\/download<\/a><\/em><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After completing the installation of the Anaconda navigator. Open&#8217;<strong> Anaconda Navigator<\/strong>&#8216;, and you can see the interface of Anaconda Navigator.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"546\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pg-1024x546.png\" alt=\"Conda Pg\" class=\"wp-image-58287\" style=\"width:608px;height:auto\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pg-1024x546.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pg-300x160.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pg-768x409.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pg-1536x818.png 1536w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pg.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>As shown in the above image, you can see the interface of &#8216;<strong>Anaconda Navigator<\/strong>&#8216;. <br>Also, you can directly use an &#8216;<strong>Anaconda prompt<\/strong>&#8216;. Simply search an anaconda prompt in the search bar and open it. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Here we will create an environment with a specified Python version. To create a conda environment of a defined Python version, open the <strong>Anaconda Navigator<\/strong>, and on the left side you can see the <strong>&#8216;environments&#8217;<\/strong> click on it. It will display the environments as shown below.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"355\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env-1024x355.png\" alt=\"Conda Env\" class=\"wp-image-58288\" style=\"width:799px;height:auto\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env-1024x355.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env-300x104.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env-768x266.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env-1536x532.png 1536w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Here we have only one &#8216;<strong>base (root)<\/strong>&#8216; environment. There is a button click on it, now you can see different options like open terminal, open with Ipython, and open with Jupyter Notebook.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"344\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_playbutton-1024x344.png\" alt=\"Conda Playbutton\" class=\"wp-image-58289\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_playbutton-1024x344.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_playbutton-300x101.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_playbutton-768x258.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_playbutton.png 1227w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now click on &#8216;<strong>Open Terminal<\/strong>&#8216;, and then you can see a command prompt.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"193\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_base_env.png\" alt=\"Conda Base Env\" class=\"wp-image-58290\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_base_env.png 705w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_base_env-300x82.png 300w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/figure>\n\n\n\n<p>Here you can see a &#8216;<strong>base<\/strong>&#8216; environment and the path. If you open the terminal of another environment, you can see your environment name instead of the base. <\/p>\n\n\n\n<p>This command prompt you can directly open using an &#8216;<strong>Anaconda prompt<\/strong>&#8216;. To open an Anaconda prompt, search an anaconda prompt in the search bar and then open it. <\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"861\" height=\"892\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_search.png\" alt=\"Conda Search\" class=\"wp-image-58291\" style=\"width:419px;height:auto\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_search.png 861w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_search-290x300.png 290w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_search-768x796.png 768w\" sizes=\"auto, (max-width: 861px) 100vw, 861px\" \/><\/figure>\n\n\n\n<p>This will open the command prompt with the base environment.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To create a Conda environment with a specific Python version use the following command:<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nconda create --name env1 python=3.7\n<\/pre><\/div>\n\n\n<p>This command is used to create an environment. Here &#8216;<strong>env1<\/strong>&#8216; is the name of the environment. You can replace &#8216;<strong>env1<\/strong>&#8216; with the actual name of your environment. &#8216;<strong>python=3.7<\/strong>&#8216; is the Python version of the env1 environment. Replace<strong> 3.7 <\/strong>with the Python version you want to create an environment. So we are creating an environment named &#8216;<strong>env1<\/strong>&#8216; with Python &#8216;<strong>3.7<\/strong>&#8216; version. <\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"685\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_proceed-1024x685.png\" alt=\"Conda Proceed\" class=\"wp-image-58293\" style=\"width:555px;height:auto\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_proceed-1024x685.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_proceed-300x201.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_proceed-768x514.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_proceed.png 1215w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To proceed type &#8216;<strong>y<\/strong>&#8216; and press Enter.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env1_done-1024x547.png\" alt=\"Conda Env1 Done\" class=\"wp-image-58294\" style=\"width:541px;height:auto\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env1_done-1024x547.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env1_done-300x160.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env1_done-768x411.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_env1_done.png 1302w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now we successfully create an environment with the Python &#8216;<strong>3.7<\/strong>&#8216; version. Now to activate the &#8216;<strong>env1<\/strong>&#8216; environment use the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nconda activate env1\n<\/pre><\/div>\n\n\n<p>The <strong>&#8216;conda activate env1&#8217;<\/strong> command line is used to activate the &#8216;<strong>env1<\/strong>&#8216; environment that we have created.<\/p>\n\n\n\n<p>After that also you can check the Python version using the following command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npython --version\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"245\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyversion.png\" alt=\"Conda Pyversion\" class=\"wp-image-58295\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyversion.png 598w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyversion-300x123.png 300w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/figure>\n\n\n\n<p>Here you can see the Python version is <strong>3.7.16<\/strong> of the &#8216;<strong>env1<\/strong>&#8216; environment. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the Anaconda Navigator interface also you can see the env1 environment below the base (root).  <\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"219\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyenv1-1024x219.png\" alt=\"Conda Pyenv1\" class=\"wp-image-58296\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyenv1-1024x219.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyenv1-300x64.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyenv1-768x164.png 768w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyenv1-1536x328.png 1536w, https:\/\/www.askpython.com\/wp-content\/uploads\/2024\/01\/conda_pyenv1.png 1693w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Here on the left side, you can see we have created an <strong>&#8216;env1&#8217;<\/strong> environment and here also you can see Python version is <strong>3.7.16<\/strong>.<\/p>\n\n\n\n<p><em>Also read: <a href=\"https:\/\/www.askpython.com\/python-modules\/python-anaconda-tutorial\" data-type=\"post\" data-id=\"10679\">Python Anaconda Tutorial \u2013 Getting Started With Anaconda<\/a><\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>Now we successfully created a conda environment with the specific Python version using above mentioned steps. Using the same process you can create environments like this with the specified Python versions you want to create to avoid the dependencies issues. You can use the Anaconda navigator interface or the Anaconda prompt to create the environment. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">References<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>https:\/\/stackoverflow.com\/questions\/56713744\/how-to-create-conda-environment-with-specific-python-version<\/li>\n\n\n\n<li>https:\/\/docs.conda.io\/projects\/conda\/en\/latest\/user-guide\/tasks\/manage-environments.html<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Creating a conda environment with a specific Python version is common in various fields like data science and machine learning, scientific computing, and bioinformatics. It ensures the compatibility and consistency of the project. Different projects or applications may have dependencies on a particular version of Python. Creating a conda environment with a defined Python version [&hellip;]<\/p>\n","protected":false},"author":79,"featured_media":64035,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-58277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts\/58277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/comments?post=58277"}],"version-history":[{"count":0,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts\/58277\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/media\/64035"}],"wp:attachment":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/media?parent=58277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/categories?post=58277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/tags?post=58277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}