{"id":823,"date":"2022-08-05T11:16:00","date_gmt":"2022-08-05T05:46:00","guid":{"rendered":"https:\/\/geekpython.in\/?p=823"},"modified":"2023-08-15T16:40:08","modified_gmt":"2023-08-15T11:10:08","slug":"how-to-create-virtual-environments-using-venv-in-python","status":"publish","type":"post","link":"https:\/\/geekpython.in\/how-to-create-virtual-environments-using-venv-in-python","title":{"rendered":"How To Create Virtual Environments Using venv In Python"},"content":{"rendered":"\n<p>Have you ever needed an&nbsp;<strong>isolated environment<\/strong>&nbsp;apart from your primary Python environment&nbsp;<strong>to manage the different versions of dependencies<\/strong>&nbsp;for your project?<\/p>\n\n\n\n<p>That is where the&nbsp;<strong>virtual environment<\/strong>&nbsp;comes into play.<\/p>\n\n\n\n<p><strong><em>A virtual environment is a tool used to manage the dependencies required by the different projects separately by creating isolated virtual environments for them.<\/em><\/strong>&nbsp;This is used by most Python developers often.<\/p>\n\n\n\n<p>In this tutorial, we&#8217;ll learn how to use&nbsp;<a target=\"_blank\" href=\"https:\/\/docs.python.org\/3\/library\/venv.html\" rel=\"noreferrer noopener\">Python&#8217;s&nbsp;<code>venv<\/code>&nbsp;module<\/a>&nbsp;to create and manage the&nbsp;<a target=\"_blank\" href=\"https:\/\/docs.python.org\/3\/library\/venv.html#venv-def\" rel=\"noreferrer noopener\">virtual environments<\/a>&nbsp;for our project separately. Each environment created will be capable of managing different versions of the dependency and Python versions too.<\/p>\n\n\n\n<p>In the last, we&#8217;ll also see other options like&nbsp;<code>virtualenv<\/code>&nbsp;and&nbsp;<code>conda<\/code>&nbsp;to create virtual environments.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-what-is-a-virtual-environment\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-what-is-a-virtual-environment\"><\/a>What is a virtual environment?<\/h1>\n\n\n\n<p>Well, till now, you&#8217;ve got a pretty good idea of a virtual environment.<\/p>\n\n\n\n<p>A virtual environment is a&nbsp;<strong>self-contained directory tree<\/strong>&nbsp;containing the specific Python version installed and some additional third-party applications.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-why-do-we-need-a-virtual-environment\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-why-do-we-need-a-virtual-environment\"><\/a>Why do we need a virtual environment?<\/h1>\n\n\n\n<p>Why do we use a virtual environment when we don&#8217;t know why we need it?<\/p>\n\n\n\n<p>Suppose you are working on two Python projects based on&nbsp;<a target=\"_blank\" href=\"https:\/\/geekpython.in\/web-scraping-in-python-using-beautifulsoup\" rel=\"noreferrer noopener\">web scraping<\/a>. Let&#8217;s say&nbsp;<code>application_X<\/code>&nbsp;and&nbsp;<code>application_Y<\/code>&nbsp;where&nbsp;<em>application_X<\/em>&nbsp;uses&nbsp;<strong><em>beautifulsoup4=4.11.1<\/em><\/strong>&nbsp;and&nbsp;<em>application_Y<\/em>&nbsp;uses&nbsp;<strong><em>beautifulsoup4=4.10.0<\/em><\/strong>. In this situation, the dependencies will conflict, and installing either version&nbsp;<em>4.11.1<\/em>&nbsp;or&nbsp;<em>4.10.0<\/em>&nbsp;will leave one of the applications unable to run.<\/p>\n\n\n\n<p>For such situations, virtual environments can be very helpful in managing the different dependencies for both projects.<\/p>\n\n\n\n<p>It is a&nbsp;<strong>good practice to use virtual environments<\/strong>&nbsp;for your project so that your project doesn&#8217;t conflict with one another regarding dependencies and the Python version.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-how-does-a-virtual-environment-work\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-how-does-a-virtual-environment-work\"><\/a>How does a virtual environment work?<\/h1>\n\n\n\n<p>By default, the external packages we install using&nbsp;<strong><em>pip<\/em><\/strong>&nbsp;in our Python base environment rest inside a folder called&nbsp;<strong><em>site-packages\/<\/em><\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">.\n\u2514\u2500\u2500 Python\/\n    \u251c\u2500\u2500 include\n    \u251c\u2500\u2500 Lib\/\n    \u2502   \u2514\u2500\u2500 site-packages\/\n    \u2502       \u251c\u2500\u2500 asgiref-3.5.2.dist-info \n    \u2502       \u251c\u2500\u2500 beautifulsoup4-4.11.1.dist-info\n    \u2502       \u251c\u2500\u2500 certifi-2022.6.15.dist-info\n    \u2502       \u251c\u2500\u2500 Django-4.0.6.dist-info\n    \u2502       \u251c\u2500\u2500 django\n    \u2502       \u251c\u2500\u2500 Flask-2.1.2.dist-info\n    \u2502       \u2514\u2500\u2500 flask\n    \u251c\u2500\u2500 libs\n    \u251c\u2500\u2500 Scripts\n    \u251c\u2500\u2500 tcl\n    \u2514\u2500\u2500 Tools<\/pre><\/div>\n\n\n\n<p>When we create a virtual environment using&nbsp;<code>venv<\/code>, it re-creates the file and folder structure of the standard Python installation on our OS.<\/p>\n\n\n\n<p>Python also copies the folder structure or&nbsp;<a target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Symbolic_link\" rel=\"noreferrer noopener\">symlinks<\/a>&nbsp;into that folder, the Python executable with which we&#8217;ve created our virtual environment.<\/p>\n\n\n\n<p>A symlink is a&nbsp;<strong>symbolic link<\/strong>&nbsp;that points to another file and folder in our computer or a connected file system. So basically, when we create our virtual environment, that&nbsp;<strong>virtual environment points to the file and folder of the standard Python installation to create its own environment<\/strong>.<\/p>\n\n\n\n<p>The folder structure looks like this when we create our virtual environment.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">D:\n\u2502   pyvenv.cfg\n\u2502\n\u251c\u2500\u2500\u2500Include\n\u251c\u2500\u2500\u2500Lib\n\u2502   \u2514\u2500\u2500\u2500site-packages\n\u2502       \u2502   distutils-precedence.pth\n\u2502       \u251c\u2500\u2500\u2500pip\n\u2502       \u251c\u2500\u2500\u2500pip-22.0.4.dist-info\n\u2502       \u251c\u2500\u2500\u2500pkg_resources\n\u2502       \u251c\u2500\u2500\u2500setuptools\n\u2502       \u251c\u2500\u2500\u2500setuptools-58.1.0.dist-info\n\u2502       \u2514\u2500\u2500\u2500_distutils_hack                  \n\u2502\n\u2514\u2500\u2500\u2500Scripts\n        activate\n        activate.bat\n        Activate.ps1\n        deactivate.bat\n        pip.exe\n        pip3.10.exe\n        pip3.exe\n        python.exe\n        pythonw.exe<\/pre><\/div>\n\n\n\n<p><strong>To list the directory tree, follow the steps below:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><em>cd<\/em><\/strong>&nbsp;into the virtual environment directory in your terminal.<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; cd your\/virtual\/environment\/dir<\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Then run the following command in your terminal<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; tree \/F<\/pre><\/div>\n\n\n\n<p>The above command will generate a directory tree with all the files. However, the tree generated by this command will be very long.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-setting-up-a-virtual-environment\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-setting-up-a-virtual-environment\"><\/a>Setting up a virtual environment<\/h1>\n\n\n\n<p>Remember our two applications,&nbsp;<strong><em>application_X<\/em><\/strong>, and&nbsp;<strong><em>application_Y<\/em><\/strong>, both use different versions of Beautiful Soup&nbsp;<strong><em>v4.11.1<\/em><\/strong>&nbsp;and&nbsp;<strong><em>v4.10.0<\/em><\/strong>, respectively. If we try to install&nbsp;<strong><em>v4.10.0<\/em><\/strong>&nbsp;for&nbsp;<strong><em>application_Y<\/em><\/strong>&nbsp;and then try to install&nbsp;<strong><em>v4.11.1<\/em><\/strong>&nbsp;for&nbsp;<strong><em>application_X<\/em><\/strong>&nbsp;globally then&nbsp;<strong><em>v4.10.0<\/em><\/strong>&nbsp;will be overwritten.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; python -m pip install beautifulsoup4==4.10.0\nPS&gt; python -m pip list\n\nPackage            Version\n------------------ -----------\nbeautifulsoup4     4.10.0<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; python -m pip install beautifulsoup4==4.11.1\nPS&gt; python -m pip list\n\nPackage            Version\n------------------ -----------\nbeautifulsoup4     4.11.1<\/pre><\/div>\n\n\n\n<p>But this won&#8217;t be a problem with the virtual environment if we create it for both of the applications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-creating-a-virtual-environment\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-creating-a-virtual-environment\"><\/a>Creating a virtual environment<\/h3>\n\n\n\n<p>To create a virtual environment, we&#8217;ll use Python&#8217;s&nbsp;<code>venv<\/code>&nbsp;module.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; python -m venv my_venv<\/pre><\/div>\n\n\n\n<p>Like the above command, we can create two separate virtual environments for our&nbsp;<em>application_X<\/em>&nbsp;and&nbsp;<em>application_Y<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-creating-multiple-virtual-environments-at-once\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-creating-multiple-virtual-environments-at-once\"><\/a>Creating multiple virtual environments at once<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; python -m venv application_X application_Y<\/pre><\/div>\n\n\n\n<p>The above command will create two separate virtual environments in the same directory.&nbsp;<strong>We can also specify different paths for our virtual environments<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; python -m venv application_X your\/full\/path\/to\/directory\/application_Y<\/pre><\/div>\n\n\n\n<p>For example, I am creating an application_A in the root directory and another application in the sub-directory named&nbsp;<code>app_b_path<\/code>.<\/p>\n\n\n\n<p>Then the command will be &#8211;<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; python -m venv application_A D:\\SACHIN\\Pycharm\\Virtual_environment\\app_b_path\\application_B<\/pre><\/div>\n\n\n\n<p>Please look at the folder structure of the virtual environments we have created.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"506\" height=\"646\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/Virtual-Environments-Folder-Structure.png\" alt=\"Virtual Environment Folder Structure\" class=\"wp-image-827\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-activating-a-virtual-environment\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-activating-a-virtual-environment\"><\/a>Activating a virtual environment<\/h3>\n\n\n\n<p>Great, our application has its virtual environment, but to start using it first, we must activate it.<\/p>\n\n\n\n<p>The simple command for activating any virtual environment is to execute a script that comes with the installation.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; Scripts\\activate\n\n(application_A) PS&gt;<\/pre><\/div>\n\n\n\n<p><strong>Note: Before executing the above command, make sure to change the directory to the virtual environment.<\/strong><\/p>\n\n\n\n<p>Or we can run the command &lt;<strong><em>virtual_environment_directory\/Scripts\/activate<\/em><\/strong>\\&gt; from the root directory.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; application_X\\Scripts\\activate\n\n(application_X) PS&gt;<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-installing-packages-into-it\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-installing-packages-into-it\"><\/a>Installing packages into it<\/h3>\n\n\n\n<p>Now that we have created two separate virtual environments for our&nbsp;<strong><em>application_X<\/em><\/strong>&nbsp;and&nbsp;<strong><em>application_Y<\/em><\/strong>, we can install the external dependencies we need for our project.<\/p>\n\n\n\n<p>Activating&nbsp;<strong><em>application_X<\/em><\/strong>&nbsp;and installing&nbsp;<strong><em>v4.11.1<\/em><\/strong>&nbsp;of&nbsp;<code>beautifulsoup4<\/code><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; application_X\\Scripts\\activate\n\n(application_X) PS&gt; pip install beautifulsoup4==4.11.1\n\n(application_X) PS&gt; pip list\n\nPackage        Version\n-------------- -----------\nbeautifulsoup4 4.11.1\npip            22.0.4\nsetuptools     58.1.0\nsoupsieve      2.3.2<\/pre><\/div>\n\n\n\n<p>Activating&nbsp;<strong><em>application_Y<\/em><\/strong>&nbsp;and installing&nbsp;<strong><em>v4.10.0<\/em><\/strong>&nbsp;of&nbsp;<code>beautifulsoup4<\/code><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; application_Y\\Scripts\\activate\n\n(application_Y) PS&gt; pip install beautifulsoup4==4.10.0\n\n(application_Y) PS&gt; pip list\n\nPackage        Version\n-------------- -----------\nbeautifulsoup4 4.10.0\npip            22.0.4\nsetuptools     58.1.0\nsoupsieve      2.3.2<\/pre><\/div>\n\n\n\n<p>We used&nbsp;<strong><em>pip<\/em><\/strong>&nbsp;to install the dependency just like we do globally in our standard Python Installation. Since we created and activated the virtual environments, pip will install the dependency in an isolated location.<\/p>\n\n\n\n<p>Now you can understand how we can manage different versions of dependencies and avoid system pollution or conflict between external packages.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-deactivate-the-virtual-environment\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-deactivate-the-virtual-environment\"><\/a>Deactivate the virtual environment<\/h3>\n\n\n\n<p>Once you are done with the virtual environment, you must deactivate it.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">(application_Y) PS&gt; deactivate\n\nPS&gt;<\/pre><\/div>\n\n\n\n<p>After running the&nbsp;<code>deactivate<\/code>&nbsp;command, your command prompt will return to its normal state. It means that you&#8217;ve successfully exited your virtual environment, and if you continue using Python or&nbsp;<code>pip<\/code>&nbsp;in your command prompt, you&#8217;ll directly interact with globally installed Python.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-other-popular-options\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-other-popular-options\"><\/a>Other popular options<\/h1>\n\n\n\n<p>Python&#8217;s&nbsp;<code>venv<\/code>&nbsp;module is a great tool to work with virtual environments, and its main advantage is that it comes preinstalled with Python. But there are other popular options also available.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Virtualenv<\/li>\n\n\n\n<li>Conda<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-virtualenv\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-virtualenv\"><\/a>Virtualenv<\/h2>\n\n\n\n<p>It is a tool for creating isolated Python environments. Virtualenv allows some great features that a typical in-built&nbsp;<code>venv<\/code>&nbsp;module doesn&#8217;t provide.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Speed<\/strong>&nbsp;matters. It creates a virtual environment more quickly.<\/li>\n\n\n\n<li>Automatically discovers the installed Python version.<\/li>\n\n\n\n<li>Tools can be upgraded using&nbsp;<code>pip<\/code><\/li>\n<\/ul>\n\n\n\n<p>Installing the&nbsp;<code>virtualenv<\/code>&nbsp;package globally<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; pip install virtualenv<\/pre><\/div>\n\n\n\n<p>Creating a virtual environment using&nbsp;<code>virtualenv<\/code>&nbsp;and activating it<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; virtualenv my_virtualenv\n\nPS&gt; ls\n\nMode            LastWrite        Time         Length   Name\n----            ----------       ---          ------   ----\nd-----          8\/4\/2022         6:07 PM               my_virtualenv<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; my_virtualenv\/Scripts\/activate\n\n(my_virtualenv) PS&gt;<\/pre><\/div>\n\n\n\n<p>If the virtual environment doesn&#8217;t activate, try changing your system&#8217;s&nbsp;<strong><em>Execution Policy<\/em><\/strong>.<\/p>\n\n\n\n<p>For Windows PowerShell<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:ps decode:true \">PS&gt; Set-ExecutionPolicy Unrestricted -Scope Process<\/pre><\/div>\n\n\n\n<p>This command will remove the restriction for the current process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-conda\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-conda\"><\/a>Conda<\/h2>\n\n\n\n<p>Conda is an open-source&nbsp;<strong>package<\/strong>&nbsp;and&nbsp;<strong>environment management system<\/strong>&nbsp;that runs on Windows, macOS, and Linux. It comes with&nbsp;<a target=\"_blank\" href=\"https:\/\/www.anaconda.com\/products\/distribution\" rel=\"noreferrer noopener\">Anaconda Python Distribution<\/a>. It was created primarily for Python programs but later extended support for most programming languages.<\/p>\n\n\n\n<p>We can also set&nbsp;<code>conda<\/code>&nbsp;in our system using the&nbsp;<a target=\"_blank\" href=\"https:\/\/docs.conda.io\/en\/latest\/miniconda.html\" rel=\"noreferrer noopener\">Miniconda installer<\/a>, which provides a minimal running requirement for&nbsp;<code>conda<\/code>&nbsp;on our system.<\/p>\n\n\n\n<p>Conda easily creates, saves, loads, and switches between environments on our local computer.<\/p>\n\n\n\n<p>After downloading Anaconda or Miniconda, follow the further steps.<\/p>\n\n\n\n<p>Anaconda comes with its own PowerShell Prompt called&nbsp;<strong><em>Anaconda PowerShell Prompt<\/em><\/strong>&nbsp;and we are going to use it to create and activate virtual environments using&nbsp;<strong><em>conda<\/em><\/strong>.<\/p>\n\n\n\n<p><strong>Creating a virtual environment using<\/strong>&nbsp;<code>conda<\/code><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:zsh decode:true \">(base) PS&gt; conda create -n virtualconda<\/pre><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Note: If you use Windows PowerShell to create virtual environments using conda, you might encounter some errors. So try to add your Anaconda installation to the PATH.<\/p>\n<\/blockquote>\n\n\n\n<p><strong>Activating our&nbsp;<em>virtualconda<\/em>&nbsp;environment<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:zsh decode:true \">(base) PS&gt; conda activate virtualconda\n\n(virtualconda) PS&gt;<\/pre><\/div>\n\n\n\n<p><strong>Installing packages<\/strong><\/p>\n\n\n\n<p>We were using&nbsp;<code>pip<\/code>&nbsp;to install external packages but in this case, we have to use&nbsp;<code>conda<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:zsh decode:true \">(virtualconda) PS&gt; conda install pandas<\/pre><\/div>\n\n\n\n<p>All the necessary packages will be installed along with&nbsp;<strong>Python<\/strong>&nbsp;(the same version as on your system) and&nbsp;<code>pandas<\/code>.<\/p>\n\n\n\n<p><strong>Deactivating our&nbsp;<em>virtualconda<\/em>&nbsp;environment<\/strong><\/p>\n\n\n\n<p>After finishing work with the virtual environment, deactivate it.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:zsh decode:true \">(virtualconda) PS&gt; conda deactivate\n\n(base) PS&gt;<\/pre><\/div>\n\n\n\n<p>The virtual environments are stored inside the&nbsp;<strong><em>envs<\/em><\/strong>&nbsp;folder inside the Anaconda installation path.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"heading-conclusion\"><a href=\"https:\/\/geekpython.in\/python-virtual-environments-venv#heading-conclusion\"><\/a>Conclusion<\/h1>\n\n\n\n<p>We created many virtual environments throughout this tutorial using different packages and in-built modules.<\/p>\n\n\n\n<p>We now understand the use of virtual environments for our projects, and how helpful they can be for managing the different projects with dependencies of different versions separately. It is good practice to have an isolated environment to avoid conflicts and system pollution.<\/p>\n\n\n\n<p>We&#8217;ve built a thorough understanding of the virtual environments and now we can use them for our projects without a second thought.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83c\udfc6<strong>Other articles you might be interested in if you liked this one<\/strong><\/p>\n\n\n\n<p>\u2705<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/reverse-vs-reversed-in-python\" target=\"_blank\">Comparing the list reverse and reversed functions<\/a>.<\/p>\n\n\n\n<p>\u2705<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/different-ways-to-reverse-a-python-list\" target=\"_blank\">8 different ways to reverse a Python list<\/a>.<\/p>\n\n\n\n<p>\u2705<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/argmax-function-in-numpy-and-tensorflow\" target=\"_blank\">NumPy argmax() and TensorFlow argmax() &#8211; Are they similar<\/a>?<\/p>\n\n\n\n<p>\u2705<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/exec-function-in-python\" target=\"_blank\">Execute your code dynamically using the exec() in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/shutil-module-in-python\" target=\"_blank\">Perform high-level file operations on files in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/python-enumerate-function-with-example-beginners-guide\" target=\"_blank\">Number your iterable data using the enumerate() in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/understanding-args-and-kwargs-in-python-best-practices-and-guide\" target=\"_blank\">Understanding&nbsp;args<em> <\/em>and&nbsp;kwargs in function parameters in Python<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>That&#8217;s all for now<\/strong><\/p>\n\n\n\n<p><strong>Keep Coding\u270c\u270c<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever needed an&nbsp;isolated environment&nbsp;apart from your primary Python environment&nbsp;to manage the different versions of dependencies&nbsp;for your project? That is where the&nbsp;virtual environment&nbsp;comes into play. A virtual environment is a tool used to manage the dependencies required by the different projects separately by creating isolated virtual environments for them.&nbsp;This is used by most Python [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":824,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[2],"tags":[12,31],"class_list":["post-823","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python","tag-python3","entry","has-media"],"_links":{"self":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/comments?post=823"}],"version-history":[{"count":4,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/823\/revisions"}],"predecessor-version":[{"id":1367,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/823\/revisions\/1367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media\/824"}],"wp:attachment":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media?parent=823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/categories?post=823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/tags?post=823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}