Venv behaviour change py3.9

Eryk Sun eryksun at gmail.com
Mon Feb 15 06:41:56 EST 2021


On 2/15/21, Abdur-Rahmaan Janhangeer <arj.python at gmail.com> wrote:
>
> I downloaded Python 3.9 yesterday, added the root folder to path
> renamed python.exe to py39.exe and did
> py39 -m venv venv
> the output was
> No such file or directory but i dont remember the exact phrase

Probably you downloaded the embedded distribution, which does not
included the venv package. Get the installer for the development
distribution instead:

https://www.python.org/ftp/python/3.9.1/python-3.9.1-amd64.exe

Note that "python-3.9.1-amd64.exe" is an installer only. It does not
run Python. If you run the installer again after a successful
installation, it gives you the option to modify, repair, or uninstall
the installation.

By default, the development distribution installs for the current user
in "%LocalAppData%\Programs\Python\Python<major><minor>[-32]". In the
case of Python 3.9, "<major><minor>" is "39". The "-32" suffix is
appended only for 32-bit Python. If you select to install Python for
all users in the "Advanced Options" dialog, the default installation
directory changes to
"%ProgramFiles[(x86)]%\Python<major><minor>[-32]".

Installing for all users requires administrator access at the time of
installation, but not to run Python. However, if the base installation
is in a secure system directory, administrator access will be required
in order to install packages via pip (i.e. you'll need to use an
elevated shell). This is a good choice if you develop with virtual
environments or always install packages with the --user option instead
of installing to the base installation.

The "py" launcher is also installed by default. Normally the launcher
is installed for all users in "%SystemRoot%". It can instead be
installed for just the current user in
%LocalAppData%\Programs\Python\Launcher".

The installer has an option to associate .py files with the launcher,
which enables running scripts directly from a CLI or GUI shell (e.g.
by double clicking on a script). The launcher supports Unix shebang
lines, if you're familiar with that. See the documentation for more
details.

There is also an option to configure the current user or system
environment variables to run Python, which includes adding ".PY" to
PATHEXT and adding the scripts and installation directories to PATH.
The latter is required to run Python via the "python" command in a
shell. That said, if the launcher is installed, then the "py" command
is always available as an alternative to directly running "python",
e.g. "py -m venv <env_dir>".


More information about the Python-list mailing list