Problem:
It seems that py.exe cannot detect that we are using a virtual environment. So, if I run a script with the py command and with the environment activated, it will not take it into account.
If needed, I can provide more information or do tests.
Environment:
Windows 10, PowerShell, Poetry
Example:
(myproject-py3.11) PS F:\myproject> pyenv global; pyenv local
3.12.3
3.11.9
(myproject-py3.11) PS F:\myproject> python -V; python -c "import sys; print(sys.executable)"
Python 3.11.9
F:\myproject\.venv\Scripts\python.exe
(myproject-py3.11) PS F:\myproject> py -V; py -c "import sys; print(sys.executable)"
Python 3.11.9
C:\Users\PC\.pyenv\pyenv-win\versions\3.11.9\python.exe