-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Toshio Kuratomi wrote: > On Wed, Nov 11, 2009 at 09:46:25AM -0800, Tom Epperly wrote: >> I thought distutils.sysconfig.get_python_lib() might be helpful, but it >> returns "/usr/lib/python2.6/site-packages" even on the system where >> "/usr/lib64/python2.6/site-packages" is the right answer. >> > You're on the right track here. You just need one more piece of > information: > > distutils.sysconfig.get_python_lib() will return the path where pure python > extensions get installed. > > distutils.sysconfig.get_python_lib(1) will return the path where compiled > extensions get installed.
On my x86_64 Ubuntu box:: $ uname -a Linux mred 2.6.27-15-generic #1 SMP Tue Oct 20 06:50:36 UTC 2009 \ x86_64 GNU/Linux $ which python /usr/bin/python $ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(); print get_python_lib(1); print get_python_lib(0, 1); print get_python_lib(1, 1)" /usr/lib/python2.5/site-packages /usr/lib/python2.5/site-packages /usr/lib/python2.5 /usr/lib/python2.5 which is indeed the right answer:: $ ls -laF /usr/lib/python2.5 total 7292 drwxr-xr-x 22 root root 20480 2009-04-29 15:44 ./ drwxr-xr-x 196 root root 77824 2009-10-25 21:41 ../ -rw-r--r-- 1 root root 33417 2008-10-05 16:59 aifc.py ... even though it is the same answer on my 32-bit box:: $ uname -a Linux scout 2.6.28-16-generic #55-Ubuntu SMP Tue Oct 20 19:48:24 UTC \ 2009 i686 GNU/Linux $ which python /usr/bin/python $ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(); print get_python_lib(1); print get_python_lib(0, 1); print get_python_lib(1, 1)" /usr/lib/python2.6/dist-packages /usr/lib/python2.6/dist-packages /usr/lib/python2.6 /usr/lib/python2.6 $ ls -laF /usr/lib/python2.6 total 8424 drwxr-xr-x 23 root root 20480 2009-04-20 10:00 ./ drwxr-xr-x 230 root root 69632 2009-11-11 12:07 ../ -rw-r--r-- 1 root root 13625 2009-04-18 22:43 _abcoll.py ... On a FreeBSD box: $ uname -a FreeBSD zap20 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 \ UTC 2009 \ [email protected]:/usr/obj/usr/src/sys/GENERIC amd64 $ which python /usr/local/bin//python $ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(); print get_python_lib(1); print get_python_lib(0, 1); print get_python_lib(1, 1)" /usr/local/lib/python2.5/site-packages /usr/local/lib/python2.5/site-packages /usr/local/lib/python2.5 /usr/local/lib/python2.5 I don't have access to a 64-bit box where the right answer would be '/usr/lib64/python2.x'. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 [email protected] Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkr7A8UACgkQ+gerLs4ltQ5HcACdG8r2/LoOVhUFeaC15ZjY/VPq qiEAoNNWpUR9tROkBhFSKVlFdMlEto0A =Fu69 -----END PGP SIGNATURE----- _______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
