Currently working with Python in WIndows 10.
I am trying to setup PowerShell so that Python would find scripts even if I am currently in different folder. Simply speaking, I would like to run script as follows
python myscript.py
instead of
python D:\aaa\bbb\myscript.py
I have only tried to append the extra folders to environment variable Path
in PowerShell
$Env:Path = $Env:Path + ';D:\aaa\bbb'
and the script can be found itself, such as I can use TAB to autocomplete a script name, however python still does not recognise the file, that is python myscript.py
still returns [Error] No such file as myscript.py
.
Is there any environment variable that controls locations where script are searched? PYTHONPATH
seems to be for imported modules inside Python interpreter.