Normally when I want to run a script from the command prompt or shell I navigate to the directory my script file is in and type python <name script>.py and press Enter
D:\TestPython>python run.py
here a demo run
However at the moment a script I want to run relies an a package in the virtual environment. In the Python documentation I found a way to solve this relying on the execution of an activate.bat file:
D:\TestPython>C:\Users\elmex\VENV\Scripts\activate.bat
(VENV) D:\TestPython>python run.py
here a demo run
Now I wonder if there is an alternative to this, something like D:\TestPython>python use all packages form virt env this <dir> run.py.
D:\TestPythonto thePATHenvironment variable and.PYto thePATHEXTenvironment variable. Then you can executerunfrom any working directory. The shell will find "run.py", get the associated command template (e.g.py.exe "%1" %*), expand the template, and execute the command.#!C:\Users\elmex\VENV\Scripts\python.exe.