import sys
from os.path import abspath, dirname
sys.path.insert(0, dirname(dirname(abspath(__file__))))
path1 = dirname(abspath(__file__)) # current folder
path2 = dirname(path1) # parent folder
print(path1)
print(path2)
To add Python to the Windows Path, follow these steps:
1. Start the Run box and enter sysdm.cpl
2. In the System Properties window go to the Advanced tab and
click the Environment Variables button
3. In the System variable window, find the Path variable and
click Edit
4. Position your cursor at the end of the Variable value line
and add the path to the python.exe file, preceeded with
the semicolon character (;)
Simply add this path to your PYTHONPATH environment variable.
To do this, go to Control Panel / System / Advanced / Environment variable,
and in the "User variables" sections, check if you already have PYTHONPATH.
If yes, select it and click "Edit", if not, click "New" to add it.
Paths in PYTHONPATH should be separated with ";".