@@ -14,29 +14,37 @@ virtualenv
14
14
`virtualenv <http://pypi.python.org/pypi/virtualenv >`_ is a tool to create
15
15
isolated Python environments.
16
16
17
- Install it via pip::
17
+ Install it via pip:
18
+
19
+ .. code-block :: console
18
20
19
21
$ pip install virtualenv
20
22
21
23
Basic Usage
22
24
~~~~~~~~~~~
23
25
24
- 1. Create a virtual environment::
26
+ 1. Create a virtual environment:
27
+
28
+ .. code-block :: console
25
29
26
- $ virtualenv ENVIRONMENT_NAME
30
+ $ virtualenv venv
27
31
28
32
This creates a copy of Python in whichever directory you ran the command in,
29
- placing it in a folder named ``ENVIRONMENT_NAME ``.
33
+ placing it in a folder named ``venv ``.
34
+
35
+ 2. To begin using the virtual environment, it needs to be activated:
30
36
31
- 2. To begin using the virtual environment, it needs to be activated::
37
+ .. code-block :: console
32
38
33
- $ source ENVIRONMENT_NAME /bin/activate
39
+ $ source venv /bin/activate
34
40
35
41
You can then begin installing any new modules without affecting the system
36
42
default Python or other virtual environments.
37
43
38
44
3. If you are done working in the virtual environment for the moment, you can
39
- deactivate it::
45
+ deactivate it:
46
+
47
+ .. code-block :: console
40
48
41
49
$ deactivate
42
50
@@ -45,49 +53,64 @@ installed libraries.
45
53
46
54
To delete a virtual environment, just delete its folder.
47
55
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.
59
+
48
60
virtualenvwrapper
49
61
-----------------
50
62
51
63
`virtualenvwrapper <http://www.doughellmann.com/projects/virtualenvwrapper/ >`_
52
64
provides a set of commands which makes working with virtual environments much
53
- more pleasant. It also places all your virtual environments into one place.
65
+ more pleasant. It also places all your virtual environments in one place.
54
66
55
- To install (make sure **virtualenv ** is already installed)::
67
+ To install (make sure **virtualenv ** is already installed):
68
+
69
+ .. code-block :: console
56
70
57
71
$ pip install virtualenvwrapper
58
72
$ export WORKON_HOME=~/Envs
59
73
$ source /usr/local/bin/virtualenvwrapper.sh
60
74
61
- (Full instructions ` here <http://www.doughellmann.com/docs/virtualenvwrapper/#introduction >`_.)
75
+ (` Full virtualenvwrapper install instructions <http://www.doughellmann.com/docs/virtualenvwrapper/#introduction >`_.)
62
76
63
77
Basic Usage
64
78
~~~~~~~~~~~
65
79
66
- 1. Create a virtual environment::
80
+ 1. Create a virtual environment:
81
+
82
+ .. code-block :: console
83
+
84
+ $ mkvirtualenv venv
67
85
68
- $ mkvirtualenv ENVIRONMENT_NAME
86
+ This creates the `` venv `` folder inside `` ~/Envs ``.
69
87
70
- This creates the `` ENVIRONMENT_NAME `` folder inside `` ~/Envs ``.
88
+ 2. Work on a virtual environment:
71
89
72
- 2. Work on a virtual environment::
90
+ .. code-block :: console
73
91
74
- $ workon ENVIRONMENT_NAME
92
+ $ workon venv
75
93
76
94
**virtualenvwrapper ** provides tab-completion on environment names. It really
77
95
helps when you have a lot of environments and have trouble remembering their
78
96
names.
79
97
``workon `` also deactivates whatever environment you are currently in, so you
80
98
can quickly switch between environments.
81
99
82
- 3. Deactivating is still the same::
100
+ 3. Deactivating is still the same:
101
+
102
+ .. code-block :: console
83
103
84
104
$ deactivate
85
105
86
- 4. To delete::
106
+ 4. To delete:
107
+
108
+ .. code-block :: console
87
109
88
- $ rmvirtualenv ENVIRONMENT_NAME
110
+ $ rmvirtualenv venv
89
111
90
- Other nifty commands include:
112
+ Other useful commands
113
+ ~~~~~~~~~~~~~~~~~~~~~
91
114
92
115
``lsvirtualenv ``
93
116
List all of the environments.
@@ -102,4 +125,4 @@ Other nifty commands include:
102
125
``lssitepackages ``
103
126
Shows contents of ``site-packages `` directory.
104
127
105
- A full list of commands can be found ` here <http://www.doughellmann.com/docs/virtualenvwrapper/command_ref.html#managing-environments >`_.
128
+ ` Full list of virtualenvwrapper commands <http://www.doughellmann.com/docs/virtualenvwrapper/command_ref.html#managing-environments >`_.
0 commit comments