@@ -22,10 +22,11 @@ Create a new environment, in the WORKON_HOME.
22
22
23
23
Syntax::
24
24
25
- mkvirtualenv [options] ENVNAME
25
+ mkvirtualenv [-a project_path] [-i package] [-r requirements_file] [virtualenv options] ENVNAME
26
26
27
- All command line options are passed directly to ``virtualenv ``. The
28
- new environment is automatically activated after being initialized.
27
+ All command line options except ``-a ``, ``-i ``, ``-r ``, and ``-h `` are passed
28
+ directly to ``virtualenv ``. The new environment is automatically
29
+ activated after being initialized.
29
30
30
31
::
31
32
@@ -40,10 +41,49 @@ new environment is automatically activated after being initialized.
40
41
mynewenv
41
42
(mynewenv)$
42
43
44
+ The ``-a `` option can be used to associate an existing project
45
+ directory with the new environment.
46
+
47
+ The ``-i `` option can be used to install one or more packages (by
48
+ repeating the option) after the environment is created.
49
+
50
+ The ``-r `` option can be used to specify a text file listing packages
51
+ to be installed. The argument value is passed to ``pip -r `` to be
52
+ installed.
53
+
43
54
.. seealso ::
44
55
45
56
* :ref: `scripts-premkvirtualenv `
46
57
* :ref: `scripts-postmkvirtualenv `
58
+ * `requirements file format `_
59
+
60
+ .. _requirements file format : http://www.pip-installer.org/en/latest/requirement-format.html
61
+
62
+ .. _command-mktmpenv :
63
+
64
+ mktmpenv
65
+ --------
66
+
67
+ Create a new virtualenv in the ``WORKON_HOME `` directory.
68
+
69
+ Syntax::
70
+
71
+ mktmpenv [VIRTUALENV_OPTIONS]
72
+
73
+ A unique virtualenv name is generated.
74
+
75
+ ::
76
+
77
+ $ mktmpenv
78
+ Using real prefix '/Library/Frameworks/Python.framework/Versions/2.7'
79
+ New python executable in 1e513ac6-616e-4d56-9aa5-9d0a3b305e20/bin/python
80
+ Overwriting 1e513ac6-616e-4d56-9aa5-9d0a3b305e20/lib/python2.7/distutils/__init__.py
81
+ with new content
82
+ Installing distribute...............................................
83
+ ....................................................................
84
+ .................................................................done.
85
+ This is a temporary environment. It will be deleted when deactivated.
86
+ (1e513ac6-616e-4d56-9aa5-9d0a3b305e20) $
47
87
48
88
.. _command-lsvirtualenv :
49
89
@@ -82,6 +122,8 @@ Syntax::
82
122
83
123
* :ref: `scripts-get_env_details `
84
124
125
+ .. _command-rmvirtualenv :
126
+
85
127
rmvirtualenv
86
128
------------
87
129
@@ -364,3 +406,129 @@ The directory names are added to a path file named
364
406
for the environment.
365
407
366
408
*Based on a contribution from James Bennett and Jannis Leidel. *
409
+
410
+ .. _command-toggleglobalsitepackages :
411
+
412
+ toggleglobalsitepackages
413
+ ------------------------
414
+
415
+ Controls whether the active virtualenv will access the packages in the
416
+ global Python ``site-packages `` directory.
417
+
418
+ Syntax::
419
+
420
+ toggleglobalsitepackages [-q]
421
+
422
+ Outputs the new state of the virtualenv. Use the ``-q `` switch to turn off all
423
+ output.
424
+
425
+ ::
426
+
427
+ $ mkvirtualenv env1
428
+ New python executable in env1/bin/python
429
+ Installing distribute.............................................
430
+ ..................................................................
431
+ ..................................................................
432
+ done.
433
+ (env1)$ toggleglobalsitepackages
434
+ Disabled global site-packages
435
+ (env1)$ toggleglobalsitepackages
436
+ Enabled global site-packages
437
+ (env1)$ toggleglobalsitepackages -q
438
+ (env1)$
439
+
440
+ ============================
441
+ Project Directory Management
442
+ ============================
443
+
444
+ .. seealso ::
445
+
446
+ :ref: `project-management `
447
+
448
+ .. _command-mkproject :
449
+
450
+ mkproject
451
+ ---------
452
+
453
+ Create a new virtualenv in the WORKON_HOME and project directory in
454
+ PROJECT_HOME.
455
+
456
+ Syntax::
457
+
458
+ mkproject [-t template] [virtualenv_options] ENVNAME
459
+
460
+ The template option may be repeated to have several templates used to
461
+ create a new project. The templates are applied in the order named on
462
+ the command line. All other options are passed to ``mkvirtualenv `` to
463
+ create a virtual environment with the same name as the project.
464
+
465
+ ::
466
+
467
+ $ mkproject myproj
468
+ New python executable in myproj/bin/python
469
+ Installing distribute.............................................
470
+ ..................................................................
471
+ ..................................................................
472
+ done.
473
+ Creating /Users/dhellmann/Devel/myproj
474
+ (myproj)$ pwd
475
+ /Users/dhellmann/Devel/myproj
476
+ (myproj)$ echo $VIRTUAL_ENV
477
+ /Users/dhellmann/Envs/myproj
478
+ (myproj)$
479
+
480
+ .. seealso ::
481
+
482
+ * :ref: `scripts-premkproject `
483
+ * :ref: `scripts-postmkproject `
484
+
485
+ setvirtualenvproject
486
+ --------------------
487
+
488
+ Bind an existing virtualenv to an existing project.
489
+
490
+ Syntax::
491
+
492
+ setvirtualenvproject [virtualenv_path project_path]
493
+
494
+ The arguments to ``setvirtualenvproject `` are the full paths to the
495
+ virtualenv and project directory. An association is made so that when
496
+ ``workon `` activates the virtualenv the project is also activated.
497
+
498
+ ::
499
+
500
+ $ mkproject myproj
501
+ New python executable in myproj/bin/python
502
+ Installing distribute.............................................
503
+ ..................................................................
504
+ ..................................................................
505
+ done.
506
+ Creating /Users/dhellmann/Devel/myproj
507
+ (myproj)$ mkvirtualenv myproj_new_libs
508
+ New python executable in myproj/bin/python
509
+ Installing distribute.............................................
510
+ ..................................................................
511
+ ..................................................................
512
+ done.
513
+ Creating /Users/dhellmann/Devel/myproj
514
+ (myproj_new_libs)$ setvirtualenvproject $VIRTUAL_ENV $(pwd)
515
+
516
+ When no arguments are given, the current virtualenv and current
517
+ directory are assumed.
518
+
519
+ Any number of virtualenvs can refer to the same project directory,
520
+ making it easy to switch between versions of Python or other
521
+ dependencies for testing.
522
+
523
+ .. _command-cdproject :
524
+
525
+ cdproject
526
+ ---------
527
+
528
+ Change the current working directory to the one specified as the
529
+ project directory for the active virtualenv.
530
+
531
+ Syntax::
532
+
533
+ cdproject
534
+
0 commit comments