377
edits
m (→Windows: Minor formatting fixes) |
(→General idea of the method: Mention that venv creation is currently broken on Debian unstable and point to my forum message giving two possible workarounds) |
||
Line 462: | Line 462: | ||
Just as for the [https://pip.pypa.io/ pip] command explained above, think of <code>/usr/bin/python3.4 -m venv</code> as the name of a program (it just runs the main function of the Python <tt>venv</tt> module). In the above command, you can freely choose the <venv-dir> directory. It is just a directory that is going to contain the newly-created virtual environment once this command returns (therefore, you shouldn't have anything inside it before running the command, otherwise that would be messy). | Just as for the [https://pip.pypa.io/ pip] command explained above, think of <code>/usr/bin/python3.4 -m venv</code> as the name of a program (it just runs the main function of the Python <tt>venv</tt> module). In the above command, you can freely choose the <venv-dir> directory. It is just a directory that is going to contain the newly-created virtual environment once this command returns (therefore, you shouldn't have anything inside it before running the command, otherwise that would be messy). | ||
<p> | <p>Notes:</p> | ||
<blockquote>Some systems may provide executables named <tt>pyvenv-3.4</tt> or similar. For instance, on Debian, <tt>/usr/bin/pyvenv-3.4</tt> is a “shortcut” for <code>/usr/bin/python3.4 -m venv</code>. Thus, one may type: | <blockquote> | ||
<ul><li><p>Some systems may provide executables named <tt>pyvenv-3.4</tt> or similar. For instance, on Debian, <tt>/usr/bin/pyvenv-3.4</tt> is a “shortcut” for <code>/usr/bin/python3.4 -m venv</code>. Thus, one may type:</p> | |||
<syntaxhighlight lang="shell" enclose="div"> | <syntaxhighlight lang="shell" enclose="div"> | ||
Line 469: | Line 470: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
to obtain the same effect as above: creating a virtual environment in <venv-dir> based on the Python interpreter <tt>/usr/bin/python3.4</tt>. Thanks to shell command history, using <code>/usr/bin/python3.4 -m venv</code> is not much of a problem, and since this makes it quite clear which Python interpreter is going to be used, I'll favor this syntax here rather than the shorter syntax based on <tt>pyvenv-3.4</tt>.</blockquote> | <p>to obtain the same effect as above: creating a virtual environment in <venv-dir> based on the Python interpreter <tt>/usr/bin/python3.4</tt>. Thanks to shell command history, using <code>/usr/bin/python3.4 -m venv</code> is not much of a problem, and since this makes it quite clear which Python interpreter is going to be used, I'll favor this syntax here rather than the shorter syntax based on <tt>pyvenv-3.4</tt>.</p> | ||
</li> | |||
<li><p>Currently (March 1st, 2016), this step doesn't work on Debian | |||
<i>unstable</i>—there is a reason it is called <i>unstable</i>—because the | |||
<tt>python3-venv</tt> package is broken (cf. | |||
[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815864 bug #815864]). See | |||
[http://forum.flightgear.org/viewtopic.php?f=18&t=27054&p=278031#p278031 this message on the FlightGear forum] for possible workarounds.</p> | |||
</li> | |||
</ul> | |||
</blockquote> | |||
</li><li>'''Once you have a virtual environment''' (and you can have as many as you wish), '''you can install, upgrade and uninstall Python packages inside it as a simple user''', like this: | </li><li>'''Once you have a virtual environment''' (and you can have as many as you wish), '''you can install, upgrade and uninstall Python packages inside it as a simple user''', like this: |
edits