how to find site-packages path

P

Philippe C. Martin

Hi,

I am using my own install script for my software and am looking for a
flawless way to figure out where python, and more specifically
site-packages is installed.

Any clue ?

Regards,

Philippe



--
***************************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***************************
 
V

vincent wehren

Philippe said:
Hi,

I am using my own install script for my software and am looking for a
flawless way to figure out where python, and more specifically
site-packages is installed.

You can take a look at how this is done in Lib/site.py.

Look for the bit of code that starts with

prefixes = [sys.prefix]
sitedir = None # make sure sitedir is initialized because of later 'del'
....

etc.
 
M

Michael Hoffman

Philippe said:
I am using my own install script for my software and am looking for a
flawless way to figure out where python, and more specifically
site-packages is installed.

The flawless way would be to use distutils. In fact you shouldn't even
need your own install script--it should do most of the work for you.
 
E

Eric S. Johansson

Michael said:
The flawless way would be to use distutils. In fact you shouldn't even
need your own install script--it should do most of the work for you.

can distutils install in any directory? for example, an application
which has its own modules should be completely isolated from the general
Python module namespace. how would you make distutils install in a
completely separate directory hierarchy and not touch any of the
site-packages directories or files?

it looked like that was impossible from the documentation which is why I
wrote my own installer.

---eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top