Skip to content

Commit e4025c1

Browse files
committed
Removed virtualenv and linked to central location
1 parent c5ab9e8 commit e4025c1

File tree

1 file changed

+8
-103
lines changed

1 file changed

+8
-103
lines changed

docs/dev/env.rst

Lines changed: 8 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -218,113 +218,18 @@ Interpreter Tools
218218
:::::::::::::::::
219219

220220

221-
virtualenv
221+
Virtual Environments
222222
----------
223223

224-
Virtualenv is a tool to keep the dependencies required by different projects
225-
in separate places, by creating virtual Python environments for them.
226-
It solves the "Project X depends on version 1.x but, Project Y needs 4.x"
227-
dilemma, and keeps your global site-packages directory clean and manageable.
224+
A Virtual Environment is a tool to keep the dependencies required by different projects
225+
in separate places, by creating virtual Python environments for them. It solves the
226+
"Project X depends on version 1.x but, Project Y needs 4.x" dilemma, and keeps
227+
your global site-packages directory clean and manageable.
228228

229-
`virtualenv <http://www.virtualenv.org/en/latest/index.html>`_ creates
230-
a folder which contains all the necessary executables to use the
231-
packages that a Python project would need. An example workflow is given
232-
below.
229+
For example, you can work on a project which requires Django 1.3 while also
230+
maintaining a project which requires Django 1.0.
233231

234-
Install virtualenv:
235-
236-
.. code-block:: console
237-
238-
$ pip install virtualenv
239-
240-
241-
Create a virtual environment for a project:
242-
243-
.. code-block:: console
244-
245-
$ cd my_project
246-
$ virtualenv venv
247-
248-
``virtualenv venv`` will create a folder in the current directory
249-
which will contain the Python executable files, and a copy of the ``pip``
250-
library which you can use to install other packages. The name of the
251-
virtual environment (in this case, it was ``venv``) can be anything;
252-
omitting the name will place the files in the current directory instead.
253-
254-
To start using the virtual environment, run:
255-
256-
.. code-block:: console
257-
258-
$ source venv/bin/activate
259-
260-
261-
The name of the current virtual environment will now appear on the left
262-
of the prompt (e.g. ``(venv)Your-Computer:your_project UserName$``) to
263-
let you know that it's active. From now on, any package that you install
264-
using ``pip`` will be placed in the ``venv`` folder, isolated from the global
265-
Python installation.
266-
267-
Install packages as usual:
268-
269-
.. code-block:: console
270-
271-
$ pip install requests
272-
273-
To stop using an environment, simply type ``deactivate``. To remove the
274-
environment, just remove the directory it was installed into. (In this
275-
case, it would be ``rm -rf venv``.)
276-
277-
Other Notes
278-
^^^^^^^^^^^
279-
280-
Running ``virtualenv`` with the option :option:`--no-site-packages` will not
281-
include the packages that are installed globally. This can be useful
282-
for keeping the package list clean in case it needs to be accessed later.
283-
[This is the default behavior for ``virtualenv`` 1.7 and later.]
284-
285-
In order to keep your environment consistent, it's a good idea to "freeze"
286-
the current state of the environment packages. To do this, run
287-
288-
.. code-block:: console
289-
290-
$ pip freeze > requirements.txt
291-
292-
This will create a :file:`requirements.txt` file, which contains a simple
293-
list of all the packages in the current environment, and their respective
294-
versions. Later it will be easier for a different developer (or you, if you
295-
need to re-create the environment) to install the same packages using the
296-
same versions:
297-
298-
.. code-block:: console
299-
300-
$ pip install -r requirements.txt
301-
302-
This can help ensure consistency across installations, across deployments,
303-
and across developers.
304-
305-
Lastly, remember to exclude the virtual environment folder from source
306-
control by adding it to the ignore list.
307-
308-
virtualenvwrapper
309-
-----------------
310-
311-
`Virtualenvwrapper <http://pypi.python.org/pypi/virtualenvwrapper>`_ makes
312-
virtualenv a pleasure to use by wrapping the command line API with a nicer CLI.
313-
314-
.. code-block:: console
315-
316-
$ pip install virtualenvwrapper
317-
318-
319-
Put this into your :file:`~/.bash_profile` (Linux/Mac) file:
320-
321-
.. code-block:: console
322-
323-
$ export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
324-
325-
This will prevent your virtualenvs from relying on your (global) site packages
326-
directory, so that they are completely separate.
327-
[Note: This is the default behavior for ``virtualenv`` 1.7 and later]
232+
To start using and see more information: `Virtual Environments <http://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst>`_ docs.
328233

329234
Other Tools
330235
:::::::::::

0 commit comments

Comments
 (0)