Given a Python virtual environment created with pythonXY_EXE -m venv venv
, how do I find the python executable PythonYX_EXE used to create the virtual environment?
Solutions for both MS-Windows and Linux are sought.
For Linux, I can come up with a solution by resolving the symlink with readlink -f venv/bin/python
. But for MS Windows?
A non-answer is the official Creation of virtual environments :
... pyvenv.cfg file in it with a home key pointing to the Python installation from which the command was run
My goal: Running python without copy/symlink, as those may fork multiple processes.
On MS Windows, by inspecting the source code of the venv library , the executable is located at (if symlinks are not enabled or failed)
<home-key-of-pyvenv.cfg-file>/python.exe.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.