diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index f6dff5636..ad929d9a2 100644 --- a/docs/dev/virtualenvs.rst +++ b/docs/dev/virtualenvs.rst @@ -226,23 +226,26 @@ Basic Usage .. code-block:: console $ cd my_project_folder - $ virtualenv my_project + $ virtualenv venv -``virtualenv my_project`` will create a folder in the current directory which will +``virtualenv venv`` will create a folder in the current directory which will contain the Python executable files, and a copy of the ``pip`` library which you can use to install other packages. The name of the virtual environment (in this -case, it was ``my_project``) can be anything; omitting the name will place the files +case, it was ``venv``) can be anything; omitting the name will place the files in the current directory instead. +.. note:: + 'venv' is the general convention used globally. As it is readily available in ignore files (eg: .gitignore') + This creates a copy of Python in whichever directory you ran the command in, -placing it in a folder named :file:`my_project`. +placing it in a folder named :file:`venv`. You can also use the Python interpreter of your choice (like ``python2.7``). .. code-block:: console - $ virtualenv -p /usr/bin/python2.7 my_project + $ virtualenv -p /usr/bin/python2.7 venv or change the interpreter globally with an env variable in ``~/.bashrc``: @@ -254,12 +257,20 @@ or change the interpreter globally with an env variable in ``~/.bashrc``: .. code-block:: console - $ source my_project/bin/activate + $ source venv/bin/activate The name of the current virtual environment will now appear on the left of -the prompt (e.g. ``(my_project)Your-Computer:your_project UserName$)`` to let you know +the prompt (e.g. ``(venv)Your-Computer:your_project UserName$)`` to let you know that it's active. From now on, any package that you install using pip will be -placed in the ``my_project`` folder, isolated from the global Python installation. +placed in the ``venv`` folder, isolated from the global Python installation. + +For Windows, same command which is mentioned in step 1 can be used for creation of virtual environment. But, to activate, we use the following command. + +Assuming that you are in project directory: + +.. code-block:: powershell + + PS C:\Users\suryav> \venv\Scripts\activate Install packages as usual, for example: @@ -284,6 +295,9 @@ After a while, though, you might end up with a lot of virtual environments littered across your system, and it's possible you'll forget their names or where they were placed. +.. note:: + Python has included venv module from version 3.3. For more details: `venv `_. + Other Notes ~~~~~~~~~~~