Matt Joiner
Matt Joiner

Reputation: 118710

Path of current Python instance?

I need to access the Scripts and tcl sub-directories of the currently executing Python instance's installation directory on Windows.

What is the best way to locate these directories?

Upvotes: 1

Views: 901

Answers (2)

ChristopheD
ChristopheD

Reputation: 116287

Have a look at sys.prefix and sys.exec_prefix

>>> import sys
>>> sys.prefix
'/System/Library/Frameworks/Python.framework/Versions/2.6'
>>> sys.exec_prefix
'/System/Library/Frameworks/Python.framework/Versions/2.6'

Upvotes: 3

djc
djc

Reputation: 11731

Hmm, find the Lib dir from sys.path and extrapolate from there?

Upvotes: 0

Related Questions