开发者

Path of current Python instance?

开发者 https://www.devze.com 2022-12-20 03:55 出处:网络
I 开发者_Python百科need to access the Scripts and tcl sub-directories of the currently executing Python instance\'s installation directory on Windows.

I 开发者_Python百科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?


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'


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

0

精彩评论

暂无评论...
验证码 换一张
取 消