Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cd9b746b
Commit
cd9b746b
authored
Jul 09, 2012
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cross-references to venv definition.
parent
6dc9f0ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
37 deletions
+20
-37
Doc/library/sys.rst
Doc/library/sys.rst
+14
-11
Doc/library/venv.rst
Doc/library/venv.rst
+3
-1
Doc/using/scripts.rst
Doc/using/scripts.rst
+3
-25
No files found.
Doc/library/sys.rst
View file @
cd9b746b
...
@@ -32,10 +32,11 @@ always available.
...
@@ -32,10 +32,11 @@ always available.
.. data:: base_exec_prefix
.. data:: base_exec_prefix
Set during Python startup, before ``site.py`` is run, to the same value as
Set during Python startup, before ``site.py`` is run, to the same value as
:data:`exec_prefix`. If not running in a virtual environment, the values
:data:`exec_prefix`. If not running in a
will stay the same; if ``site.py`` finds that a virtual environment is in
:ref:`virtual environment <venv-def>`, the values will stay the same; if
use, the values of :data:`prefix` and :data:`exec_prefix` will be changed to
``site.py`` finds that a virtual environment is in use, the values of
point to the virtual environment, whereas :data:`base_prefix` and
:data:`prefix` and :data:`exec_prefix` will be changed to point to the
virtual environment, whereas :data:`base_prefix` and
:data:`base_exec_prefix` will remain pointing to the base Python
:data:`base_exec_prefix` will remain pointing to the base Python
installation (the one which the virtual environment was created from).
installation (the one which the virtual environment was created from).
...
@@ -45,7 +46,7 @@ always available.
...
@@ -45,7 +46,7 @@ always available.
.. data:: base_prefix
.. data:: base_prefix
Set during Python startup, before ``site.py`` is run, to the same value as
Set during Python startup, before ``site.py`` is run, to the same value as
:data:`prefix`. If not running in a
virtual environment
, the values
:data:`prefix`. If not running in a
:ref:`virtual environment <venv-def>`
, the values
will stay the same; if ``site.py`` finds that a virtual environment is in
will stay the same; if ``site.py`` finds that a virtual environment is in
use, the values of :data:`prefix` and :data:`exec_prefix` will be changed to
use, the values of :data:`prefix` and :data:`exec_prefix` will be changed to
point to the virtual environment, whereas :data:`base_prefix` and
point to the virtual environment, whereas :data:`base_prefix` and
...
@@ -241,9 +242,10 @@ always available.
...
@@ -241,9 +242,10 @@ always available.
installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y*
installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y*
is the version number of Python, for example ``3.2``.
is the version number of Python, for example ``3.2``.
.. note:: If a virtual environment is in effect, this value will be changed
.. note:: If a :ref:`virtual environment <venv-def>` is in effect, this
in ``site.py`` to point to the virtual environment. The value for the
value will be changed in ``site.py`` to point to the virtual environment.
Python installation will still be available, via :data:`base_exec_prefix`.
The value for the Python installation will still be available, via
:data:`base_exec_prefix`.
.. data:: executable
.. data:: executable
...
@@ -865,9 +867,10 @@ always available.
...
@@ -865,9 +867,10 @@ always available.
stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version
stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version
number of Python, for example ``3.2``.
number of Python, for example ``3.2``.
.. note:: If a virtual environment is in effect, this value will be changed
.. note:: If a :ref:`virtual environment <venv-def>` is in effect, this
in ``site.py`` to point to the virtual environment. The value for the
value will be changed in ``site.py`` to point to the virtual
Python installation will still be available, via :data:`base_prefix`.
environment. The value for the Python installation will still be
available, via :data:`base_prefix`.
.. data:: ps1
.. data:: ps1
...
...
Doc/library/venv.rst
View file @
cd9b746b
...
@@ -88,7 +88,7 @@ a Posix platform, you would typically do::
...
@@ -88,7 +88,7 @@ a Posix platform, you would typically do::
whereas on Windows, you might do::
whereas on Windows, you might do::
c
:\> <venv>/Scripts/activate
C
:\> <venv>/Scripts/activate
if you are using the ``cmd.exe`` shell, or perhaps::
if you are using the ``cmd.exe`` shell, or perhaps::
...
@@ -108,6 +108,8 @@ a "deactivate" function, whereas on Windows there are separate scripts called
...
@@ -108,6 +108,8 @@ a "deactivate" function, whereas on Windows there are separate scripts called
``deactivate.bat`` and ``Deactivate.ps1`` which are installed when the venv is
``deactivate.bat`` and ``Deactivate.ps1`` which are installed when the venv is
created.
created.
.. _venv-def:
.. note:: A virtual environment (also called a ``venv``) is a Python
.. note:: A virtual environment (also called a ``venv``) is a Python
environment such that the Python interpreter, libraries and scripts
environment such that the Python interpreter, libraries and scripts
installed into it are isolated from those installed in other virtual
installed into it are isolated from those installed in other virtual
...
...
Doc/using/scripts.rst
View file @
cd9b746b
...
@@ -6,8 +6,8 @@ Additional Tools and Scripts
...
@@ -6,8 +6,8 @@ Additional Tools and Scripts
pyvenv - Creating virtual environments
pyvenv - Creating virtual environments
--------------------------------------
--------------------------------------
Creation of
virtual environments is done by executing the ``pyvenv``
Creation of
:ref:`virtual environments <venv-def>` is done by executing the
script::
``pyvenv``
script::
pyvenv /path/to/new/virtual/environment
pyvenv /path/to/new/virtual/environment
...
@@ -72,7 +72,7 @@ a Posix platform, you would typically do::
...
@@ -72,7 +72,7 @@ a Posix platform, you would typically do::
whereas on Windows, you might do::
whereas on Windows, you might do::
c
:\> <venv>/Scripts/activate
C
:\> <venv>/Scripts/activate
if you are using the ``cmd.exe`` shell, or perhaps::
if you are using the ``cmd.exe`` shell, or perhaps::
...
@@ -92,25 +92,3 @@ a "deactivate" function, whereas on Windows there are separate scripts called
...
@@ -92,25 +92,3 @@ a "deactivate" function, whereas on Windows there are separate scripts called
``deactivate.bat`` and ``Deactivate.ps1`` which are installed when the venv is
``deactivate.bat`` and ``Deactivate.ps1`` which are installed when the venv is
created.
created.
.. note:: A virtual environment (also called a ``venv``) is a Python
environment such that the Python interpreter, libraries and scripts
installed into it are isolated from those installed in other virtual
environments, and (by default) any libraries installed in a "system" Python,
i.e. one which is installed as part of your operating system.
A venv is a directory tree which contains Python executable files and
other files which indicate that it is a venv.
Common installation tools such as ``distribute`` and ``pip`` work as
expected with venvs - i.e. when a venv is active, they install Python
packages into the venv without needing to be told to do so explicitly.
When a venv is active (i.e. the venv's Python interpreter is running), the
attributes :attr:`sys.prefix` and :attr:`sys.exec_prefix` point to the base
directory of the venv, whereas :attr:`sys.base_prefix` and
:attr:`sys.base_exec_prefix` point to the non-venv Python installation
which was used to create the venv. If a venv is not active, then
:attr:`sys.prefix` is the same as :attr:`sys.base_prefix` and
:attr:`sys.exec_prefix` is the same as :attr:`sys.base_exec_prefix` (they
all point to a non-venv Python installation).
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment