After reading the following statement from PEP 405
A pyvenv installed script is also provided to make this more convenient:
pyvenv /path/to/new/virtual/environment
I tried to create a new virtual environment and failed miserably;
C:\>python --version
Python 3.3.1
C:\>pyvenv myvenv
'pyvenv' is not recognized as an internal or external command,
operable program or batch file.
Apparently pyvenv
script is not installed into Scripts
folder which is being usually added to the PATH
environment variable making it possible to easily run such scripts on the command line.
Is PEP 405 wrong, was it not properly implemented in Python 3.3 or am I missing something?
It looks like pyvenv
script is placed in Tools\Scripts
subfolder inside Python installation folder (sys.prefix
). It seems like copying it to Scripts
subfolder is a good idea as it allows to simply type pyvenv
from the command line (assuming Scripts
folder is already on the PATH
). As there's no exe
wrapper for this script one has to make sure
.py
extension is added to PATHEXT
environment variable so that
Windows finds Python script placed on the PATH
when typing script's
name at the command prompt..py
extension is associated either with Python executable or with Python launcher (py.exe
) which is available starting from Python 3.3Alternatively one can just type python -m venv
instead of pyvenv
and save himself all of the hassle...
Related Python bug 17480 - pyvenv should be installed someplace more obvious on Windows
Use python -m venv someenvname
instead.
Moreover, there is no strong reason to add python folder to PATH
if you use system-wide python.exe
only for creating virtual environments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With