0

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)
James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

Similar answer here: https://stackoverflow.com/a/2589722/6317430

Using the sys package:

import sys
print(sys.executable)
siralexsir88
  • 418
  • 1
  • 4
  • 14