I want to create a python program which on running gives me the python path in the linux environmental variable. In windows I am doing below way -
import os
try:
user_paths=os.environmen['path'].split(os.pathstep)
excepterror:
user_paths=[]
print(user_paths)
Similar answer here: https://stackoverflow.com/a/2589722/6317430
Using the sys package:
import sys
print(sys.executable)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.