11Virtual Environments
22====================
33
4- A Virtual Environment, put simply, is an isolated working copy of Python which
5- allows you to work on a specific project without worry of affecting other
4+ A Virtual Environment, put simply, is an isolated working copy of Python which
5+ allows you to work on a specific project without worry of affecting other
66projects.
77
8- For example, you can work on a project which requires Django 1.3 while also
8+ For example, you can work on a project which requires Django 1.3 while also
99maintaining a project which requires Django 1.0.
1010
1111virtualenv
1212----------
1313
14- `virtualenv <http://pypi.python.org/pypi/virtualenv >`_ is a tool to create
14+ `virtualenv <http://pypi.python.org/pypi/virtualenv >`_ is a tool to create
1515isolated Python environments.
1616
1717Install it via pip:
@@ -29,7 +29,7 @@ Basic Usage
2929
3030 $ virtualenv venv
3131
32- This creates a copy of Python in whichever directory you ran the command in,
32+ This creates a copy of Python in whichever directory you ran the command in,
3333placing it in a folder named ``venv ``.
3434
35352. To begin using the virtual environment, it needs to be activated:
@@ -38,30 +38,30 @@ placing it in a folder named ``venv``.
3838
3939 $ source venv/bin/activate
4040
41- You can then begin installing any new modules without affecting the system
41+ You can then begin installing any new modules without affecting the system
4242default Python or other virtual environments.
4343
44- 3. If you are done working in the virtual environment for the moment, you can
44+ 3. If you are done working in the virtual environment for the moment, you can
4545 deactivate it:
4646
4747.. code-block :: console
4848
4949 $ deactivate
5050
51- This puts you back to the system's default Python interpreter with all its
51+ This puts you back to the system's default Python interpreter with all its
5252installed libraries.
5353
5454To delete a virtual environment, just delete its folder.
5555
56- After a while, though, you might end up with a lot of virtual environments
57- littered across your system, and its possible you'll forget their names or
58- where they were placed.
56+ After a while, though, you might end up with a lot of virtual environments
57+ littered across your system, and its possible you'll forget their names or
58+ where they were placed.
5959
6060virtualenvwrapper
6161-----------------
6262
63- `virtualenvwrapper <http://www.doughellmann.com/projects/virtualenvwrapper/ >`_
64- provides a set of commands which makes working with virtual environments much
63+ `virtualenvwrapper <http://www.doughellmann.com/projects/virtualenvwrapper/ >`_
64+ provides a set of commands which makes working with virtual environments much
6565more pleasant. It also places all your virtual environments in one place.
6666
6767To install (make sure **virtualenv ** is already installed):
@@ -74,6 +74,17 @@ To install (make sure **virtualenv** is already installed):
7474
7575 (`Full virtualenvwrapper install instructions <http://www.doughellmann.com/docs/virtualenvwrapper/#introduction >`_.)
7676
77+ For Windows, you can use the `virtualenvwrapper-powershell <https://bitbucket.org/guillermooo/virtualenvwrapper-powershell >`_ clone.
78+
79+ To install (make sure **virtualenv ** is already installed):
80+
81+ .. code-block :: console
82+
83+ PS> pip install virtualenvwrapper-powershell
84+ PS> $env:WORKON_HOME="~/Envs"
85+ PS> mkdir $env:WORKON_HOME
86+ PS> import-module virtualenvwrapper
87+
7788 Basic Usage
7889~~~~~~~~~~~
7990
@@ -83,18 +94,18 @@ Basic Usage
8394
8495 $ mkvirtualenv venv
8596
86- This creates the ``venv `` folder inside ``~/Envs ``.
97+ This creates the ``venv `` folder inside ``~/Envs ``.
8798
88992. Work on a virtual environment:
89100
90101.. code-block :: console
91102
92103 $ workon venv
93104
94- **virtualenvwrapper ** provides tab-completion on environment names. It really
95- helps when you have a lot of environments and have trouble remembering their
96- names.
97- ``workon `` also deactivates whatever environment you are currently in, so you
105+ **virtualenvwrapper ** provides tab-completion on environment names. It really
106+ helps when you have a lot of environments and have trouble remembering their
107+ names.
108+ ``workon `` also deactivates whatever environment you are currently in, so you
98109can quickly switch between environments.
99110
1001113. Deactivating is still the same:
@@ -116,8 +127,8 @@ Other useful commands
116127 List all of the environments.
117128
118129``cdvirtualenv ``
119- Navigate into the directory of the currently activated virtual environment,
120- so you can browse its ``site-packages ``, for example.
130+ Navigate into the directory of the currently activated virtual environment,
131+ so you can browse its ``site-packages ``, for example.
121132
122133``cdsitepackages ``
123134 Like the above, but directly into ``site-packages `` directory.
0 commit comments