From af9971071b328a1c942d1852e1f56d72f81f7b78 Mon Sep 17 00:00:00 2001 From: Surya Teja <94suryateja@gmail.com> Date: Sun, 16 Dec 2018 19:08:05 +0530 Subject: [PATCH 1/4] Added windows virtual environment activation command. Closes #942 --- docs/dev/virtualenvs.rst | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index 11f924882..4d629d8dc 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\bin\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 its possible you'll forget their names or where they were placed. +.. note:: + Python has included virtual environment module from 3.3. It works in the simliar way as mentioned above. For details: `venv `_. + Other Notes ~~~~~~~~~~~ From 7022a9faef9b49e5b08a59ddd87b212b76f4fadf Mon Sep 17 00:00:00 2001 From: Surya Teja Reddy Valluri Date: Tue, 18 Dec 2018 22:32:01 +0530 Subject: [PATCH 2/4] Fixed typos/grammer --- docs/dev/virtualenvs.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index 4d629d8dc..fede45589 100644 --- a/docs/dev/virtualenvs.rst +++ b/docs/dev/virtualenvs.rst @@ -264,9 +264,9 @@ 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 ``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. +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: +Assuming that you are in project directory: .. code-block:: powershell @@ -296,7 +296,7 @@ littered across your system, and its possible you'll forget their names or where they were placed. .. note:: - Python has included virtual environment module from 3.3. It works in the simliar way as mentioned above. For details: `venv `_. + Python has included venv module from 3.3. For more details: `venv `_. Other Notes ~~~~~~~~~~~ From 179493d96ca18487f4596143aa02002bdc891030 Mon Sep 17 00:00:00 2001 From: Surya Teja Reddy Valluri Date: Tue, 18 Dec 2018 22:33:59 +0530 Subject: [PATCH 3/4] small typo --- docs/dev/virtualenvs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index fede45589..1919332b1 100644 --- a/docs/dev/virtualenvs.rst +++ b/docs/dev/virtualenvs.rst @@ -296,7 +296,7 @@ littered across your system, and its possible you'll forget their names or where they were placed. .. note:: - Python has included venv module from 3.3. For more details: `venv `_. + Python has included venv module from version 3.3. For more details: `venv `_. Other Notes ~~~~~~~~~~~ From dc85a33f3ac46f1c54183fbf52189004e27104f6 Mon Sep 17 00:00:00 2001 From: Surya Teja Reddy Valluri Date: Thu, 20 Dec 2018 21:34:46 +0530 Subject: [PATCH 4/4] Fixed Scripts issue --- docs/dev/virtualenvs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index e779e0e3a..ad929d9a2 100644 --- a/docs/dev/virtualenvs.rst +++ b/docs/dev/virtualenvs.rst @@ -270,7 +270,7 @@ Assuming that you are in project directory: .. code-block:: powershell - PS C:\Users\suryav> \venv\bin\activate + PS C:\Users\suryav> \venv\Scripts\activate Install packages as usual, for example: