Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of venv specifies a python3 command not found in 3.11.2 on Windows #102354

Closed
Liturgist opened this issue Mar 1, 2023 · 7 comments
Closed
Labels
docs Documentation in the Doc dir

Comments

@Liturgist
Copy link
Contributor

Liturgist commented Mar 1, 2023

Documentation

The documentation on using venv at https://docs.python.org/3/library/venv.html for 3.11.2 specifies to use a python3 executable.

I do not find a python3 executable in the 3.11.2 installation for Windows 64-bit.

Linked PRs

@Liturgist Liturgist added the docs Documentation in the Doc dir label Mar 1, 2023
@carljm
Copy link
Member

carljm commented Mar 1, 2023

A few lines later there are specific instructions for Windows:

On Windows, invoke the venv command as follows:

c:\>c:\Python35\python -m venv c:\path\to\myenv

Alternatively, if you configured the PATH and PATHEXT variables for your [Python installation] (https://docs.python.org/3/using/windows.html#using-on-windows):

c:\>python -m venv c:\path\to\myenv

Grepping the entire Doc/ directory, I see 156 occurrences of python -m and only 8 of python3 -m, so it seems like python -m is much more common in our documentation, despite the fact that a make install of Python 3 on most platforms doesn't install a python binary at all. So I'm not clear what the docs should prefer or standardize on here.

@Liturgist
Copy link
Contributor Author

@carljm, yes, I see the later instructions for Windows. But, python3 -m... is the first example and it does not specify a platform.

If python -m... works on all platforms, perhaps that should be used.

@carljm
Copy link
Member

carljm commented Mar 1, 2023

python -m ... does not work on all platforms, unless you are in a venv, or your distro or someone else has decided to link python to python3. Just building and installing python on POSIX installs only bin/python3, there's no python.

I feel sure this is something that has been discussed before; I'll see if I can find out what the thinking has been.

@carljm
Copy link
Member

carljm commented Mar 1, 2023

Looks like the conclusion in #98761 was that python -m ... should be preferred in the docs. So @Liturgist, if you are interested in making a pull request to convert the few cases of python3 -m ... to python -m ... (including this one), it looks like that would be appropriate.

See also #102358 for providing bin/python in make install, so we are more consistent in our preference for python -m ....

@carljm carljm changed the title Usage of venv specifies a python3 command not found in 3.11.2 Usage of venv specifies a python3 command not found in 3.11.2 on Windows Mar 1, 2023
@Liturgist
Copy link
Contributor Author

@carljm, here are the mentions of python 3 -m I find. It would appear that this specific issue is about ./using/venv-create.inc. Is that the only change to be made? Should others be considered. Is this issue, #102354, the one to fix?

PS C:\src\cpython\Doc> dir -File -Recurse * | %{sls 'python3 -m' $_}

Makefile:157:           $(VENVDIR)/bin/python3 -m pip install -U pip setuptools; \
Makefile:158:           $(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
library\__main__.rst:262:   block. You can invoke it with ``python3 -m venv [directory]``.
library\importlib.metadata.rst:76:    $ python3 -m venv example
library\pdb.rst:61:   python3 -m pdb myscript.py
library\pdb.rst:75:   ``python3 -m`` does. As with a script, the debugger will pause execution just
tutorial\venv.rst:47:   python3 -m venv tutorial-env
using\venv-create.inc:4:    python3 -m venv /path/to/new/virtual/environment
whatsnew\3.10.rst:1542:  The ``python3 -m module-name`` command startup time is 1.4x faster in
whatsnew\3.6.rst:2060:The ``pyvenv`` script has been deprecated in favour of ``python3 -m venv``.

@carljm
Copy link
Member

carljm commented Mar 14, 2023

I think it makes sense to be consistent in our usage in the docs, so I think it would be fine to update all of the cases (other than the Makefile.) And yes, you can use this issue.

@Liturgist
Copy link
Contributor Author

@carljm, I think I have made the changes and created a PR. Please let me know of anything I may have not done or done incorrectly.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 14, 2023
…102696)

(cherry picked from commit 80abd62)

Co-authored-by: Paul Watson <paul.hermeneutic@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 14, 2023
…102696)

(cherry picked from commit 80abd62)

Co-authored-by: Paul Watson <paul.hermeneutic@gmail.com>
carljm pushed a commit that referenced this issue Mar 14, 2023
… (#102698)

gh-102354: change python3 to python in docs examples (GH-102696)
(cherry picked from commit 80abd62)

Co-authored-by: Paul Watson <paul.hermeneutic@gmail.com>
carljm pushed a commit that referenced this issue Mar 14, 2023
… (#102697)

gh-102354: change python3 to python in docs examples (GH-102696)
(cherry picked from commit 80abd62)

Co-authored-by: Paul Watson <paul.hermeneutic@gmail.com>
@carljm carljm closed this as completed Mar 14, 2023
carljm added a commit to carljm/cpython that referenced this issue Mar 14, 2023
* main: (50 commits)
  pythongh-102674: Remove _specialization_stats from Lib/opcode.py (python#102685)
  pythongh-102660: Handle m_copy Specially for the sys and builtins Modules (pythongh-102661)
  pythongh-102354: change python3 to python in docs examples (python#102696)
  pythongh-81057: Add a CI Check for New Unsupported C Global Variables (pythongh-102506)
  pythonGH-94851: check unicode consistency of static strings in debug mode (python#102684)
  pythongh-100315: clarification to `__slots__` docs. (python#102621)
  pythonGH-100227: cleanup initialization of global interned dict (python#102682)
  doc: Remove a duplicate 'versionchanged' in library/asyncio-task (pythongh-102677)
  pythongh-102013: Add PyUnstable_GC_VisitObjects (python#102014)
  pythonGH-102670: Use sumprod() to simplify, speed up, and improve accuracy of statistics functions (pythonGH-102649)
  pythongh-102627: Replace address pointing toward malicious web page (python#102630)
  pythongh-98831: Use DECREF_INPUTS() more (python#102409)
  pythongh-101659: Avoid Allocation for Shared Exceptions in the _xxsubinterpreters Module (pythongh-102659)
  pythongh-101524: Fix the ChannelID tp_name (pythongh-102655)
  pythongh-102069: Fix `__weakref__` descriptor generation for custom dataclasses (python#102075)
  pythongh-98169 dataclasses.astuple support DefaultDict (python#98170)
  pythongh-102650: Remove duplicate include directives from multiple source files (python#102651)
  pythonGH-100987: Don't cache references to the names and consts array in `_PyEval_EvalFrameDefault`. (python#102640)
  pythongh-87092: refactor assemble() to a number of separate functions, which do not need the compiler struct (python#102562)
  pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (python#102631)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants