Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

Find where python is installed (if it isn't default dir)

Python is on my machine, I just don't know where, if I type python in terminal it will open Python 2.6.4, this isn't in it's default directory, there surely is a way of finding it's install location from here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

sys has some useful stuff:

$ python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'c:\Python26\python.exe'
>>> sys.exec_prefix
'c:\Python26'
>>>
>>> print '
'.join(sys.path)

c:Python26libsite-packagessetuptools-0.6c11-py2.6.egg
c:Python26libsite-packages
ose-1.0.0-py2.6.egg
C:Windowssystem32python26.zip
c:Python26DLLs
c:Python26lib
c:Python26libplat-win
c:Python26liblib-tk
c:Python26
c:Python26libsite-packages
c:Python26libsite-packageswin32
c:Python26libsite-packageswin32lib
c:Python26libsite-packagesPythonwin
c:Python26libsite-packageswx-2.8-msw-unicode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...