To get the path of the currently running python.exe

To get the path of python.exe that is currently running this script .py file: sys.base_prefix

Console


import sys
sys.base_prefix

result


'C:\\python-3.7.4.amd64'

P.S.

On the other hand, to get the path of this script .py file running in Python: __file__

test.py


print(__file__)

result


'C:\\test.py'

Recommended Posts

To get the path of the currently running python.exe
Get the absolute path of the script you are running
Get absolute path of running process
Get the path to the systemd unit file
How to get the number of digits in Python
[Python] Get the official file path of the shortcut file (.lnk)
Get to know the feelings of gradient boosting trees
Try to get the contents of Word with Golang
Script to get the expiration date of the SSL certificate
[Selenium] How to specify the relative path of chromedriver?
Get the number of digits
Maya | Get the workspace path
Try to get the function list of Python> os package
I tried to get the location information of Odakyu Bus
I want to get the operation information of yahoo route
Keras I want to get the output of any layer !!
To get the name of the primitive etc. generated immediately before
Get the source of the page to load infinitely with python.
Get the number of views of Qiita
Get the attributes of an object
Get the first element of queryset
Get the number of Youtube subscribers
Get the desktop path in Python
Get the file path using Pathlib
Supplement to the explanation of vscode
I want to get the name of the function / method being executed
I tried to get the index of the list using the enumerate function
How to get the ID of Type2Tag NXP NTAG213 with nfcpy
How to get the vertex coordinates of a feature in ArcPy
Create a function to get the contents of the database in Go
PhytoMine-I tried to get the genetic information of plants with Python
[Python Kivy] How to get the file path by dragging and dropping
The story of trying to reconnect the client
Script to change the description of fasta
How to get rid of long comprehensions
How to check the version of Django
The story of adding MeCab to ubuntu 16.04
Learning record (4th day) #How to get the absolute path from the relative path
Get the column list & data list of CASTable
Python> sys.path> List of strings indicating the path to search for modules
Get the minutes of the Diet via API
Click the Selenium links in order to get the elements of individual pages
[Linux] Command to get a list of commands executed in the past
I measured 6 methods to get the index of the maximum value (minimum value) of the list
I tried to get the authentication code of Qiita API with Python.
Get the number of visits to each page with ReportingAPI + Cloud Functions
How to get colored output to the console
Check the path of the Python imported module
I tried to find the optimal path of the dreamland by (quantum) annealing
Get the value of the middle layer of NN
I tried to get the RSS of the top song of the iTunes store automatically
Get the last day of the specified month
[Python] Get the character code of the file
Get the song name from the title of the video you tried to sing
Get the filename of a directory (glob)
I tried to get the movie information of TMDb API with Python
The story of pep8 changing to pycodestyle
[PowerShell] Get the reading of the character string
How to get the notebook name you are currently using in Google Colab
Use twitter API to get the number of tweets related to a certain keyword
Python script to get a list of input examples for the AtCoder contest