Hi list,

It looks like the python interpreter environment is easily movable between two 
directories because the sys.prefix variable is changed automatically when I run 
the interpreter so the interpreter will find his libraries... however in the 
Python documentation I found that 
(http://docs.python.org/library/sys.html?highlight=sys#sys.prefix) the 
sys.prefix is defined at the compile time with ./configure --prefix=dir 
command...
Can I use this in production without any problem of the paths?

Please consider the following test, after I use ./configure 
--prefix=/opt/python2.6.4 && make && make install:

[r...@centos-5-4-test1 ~]# /opt/python2.6.4/bin/python
Python 2.6.4 (r264:75706, Jan 20 2010, 20:26:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
...import sys
...sys.prefix
'/opt/python2.6.4'
...sys.path
['', '/opt/python2.6.4/lib/python26.zip', '/opt/python2.6.4/lib/python2.6', 
'/opt/python2.6.4/lib/python2.6/plat-linux2', 
'/opt/python2.6.4/lib/python2.6/lib-tk', 
'/opt/python2.6.4/lib/python2.6/lib-old', 
'/opt/python2.6.4/lib/python2.6/lib-dynload', 
'/opt/python2.6.4/lib/python2.6/site-packages']


[r...@centos-5-4-test1 ~]# mv /opt/python2.6.4/ /opt/python2.6.4_newplace
[r...@centos-5-4-test1 ~]# /opt/python2.6.4_newplace/bin/python
Python 2.6.4 (r264:75706, Jan 20 2010, 20:26:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
...import sys
...sys.prefix
'/opt/python2.6.4_newplace'
...sys.path
['', '/opt/python2.6.4_newplace/lib/python26.zip', 
'/opt/python2.6.4_newplace/lib/python2.6', 
'/opt/python2.6.4_newplace/lib/python2.6/plat-linux2', 
'/opt/python2.6.4_newplace/lib/python2.6/lib-tk', 
'/opt/python2.6.4_newplace/lib/python2.6/lib-old', 
'/opt/python2.6.4_newplace/lib/python2.6/lib-dynload', 
'/opt/python2.6.4_newplace/lib/python2.6/site-packages'] 


Thanks for the help,
Balazs
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to