1import sys
2from os.path import abspath, dirname
3
4sys.path.insert(0, dirname(dirname(abspath(__file__))))
5
6path1 = dirname(abspath(__file__)) # current folder
7path2 = dirname(path1) # parent folder
8
9print(path1)
10print(path2)
1To add Python to the Windows Path, follow these steps:
2
31. Start the Run box and enter sysdm.cpl
42. In the System Properties window go to the Advanced tab and
5 click the Environment Variables button
63. In the System variable window, find the Path variable and
7 click Edit
84. Position your cursor at the end of the Variable value line
9 and add the path to the python.exe file, preceeded with
10 the semicolon character (;)