All you need is a proper combination of your current working directory, the PYTHONPATH
environment variable, and the path to the script.
If your current working directory is Downloads
, you can run the Demo.Fold2.MainFile
module without modifying PYTHONPATH
. I.e.
> python -m Demo.Fold2.MainFile
Or you can run the Demo\Fold2\MainFile.py
file if you set PYTHONPATH
to the current working directory. I.e.
> :: relative PYTHONPATH
> set PYTHONPATH=.
> python Demo\Fold2\MainFile.py
>
> :: or absolute PYTHONPATH
> set PYTHONPATH=c:\absolute\path\to\Downloads
> python Demo\Fold2\MainFile.py
If your current working directory is Demo
, you can run the Fold2.MainFile
module if you set PYTHONPATH
to the Downloads
directory. I.e.
> :: relative PYTHONPATH
> set PYTHONPATH=..
> python -m Fold2.MainFile
>
> :: or absolute PYTHONPATH
> set PYTHONPATH=c:\absolute\path\to\Downloads
> python -m Fold2.MainFile
or the Fold2\MainFile.py
file. I.e.
> :: relative PYTHONPATH
> set PYTHONPATH=..
> python Fold2\MainFile.py
>
> :: or absolute PYTHONPATH
> set PYTHONPATH=c:\absolute\path\to\Downloads
> python Fold2\MainFile.py
If your current working directory is Fold2
, you can run the MainFile
module if you set PYTHONPATH
to the Downloads
directory. I.e.
> :: relative PYTHONPATH
> set PYTHONPATH=..\..
> python -m MainFile
>
> :: or absolute PYTHONPATH
> set PYTHONPATH=c:\absolute\path\to\Downloads
> python -m MainFile
or the MainFile.py
file. I.e.
> :: relative PYTHONPATH
> set PYTHONPATH=..\..
> python MainFile.py
>
> :: or absolute PYTHONPATH
> set PYTHONPATH=c:\absolute\path\to\Downloads
> python MainFile.py