Two ways to view the Python interpreter path


1. Use the script to view information

Run the following script or enter it manually in interactive mode.

import sys
import os

print('Current Python interpreter path:')
print(sys.executable)
R """ Current Python interpreter path: C:\Users\jpch89\AppData\Local\Programs\Python\Python36\python.EXE """

print(a)print('Current Python interpreter directory:')
print(os.path.dirname(sys.executable))
R """ Current Python interpreter directory: C:\Users\jpch89\AppData\Local\Programs\Python\Python36 ""

Copy the code

2. View information on the console

Windows 版:使用 where python

C:\Users\jpch89>where python
C: \Users\jpch89\AppData\Local\Programs\Python\Python37\python.exe
C: \Users\jpch89\AppData\Local\Programs\Python\Python36\python.exe
Copy the code

Completed in 2019.01.16 Updated in 2019.02.07