Ned Deily added the comment:

A comment on Vinay's comment: "and this cannot be obtained from sys.executable 
because that is pointing to a framework executable".  That *was* true prior to 
3.3 and is still true at the moment for 2.7.x but it is not true for 3.3+.  
Ronald's change (b79d276041a8) in Issue15307 for venv framework support changed 
the stub launcher to no longer do a realpath() on the executable name which 
means that sys.executable contains the path to the Python stub launcher whether 
or not in a venv:

$ ls -l /usr/local/bin/python2.7
lrwxr-xr-x  1 root  admin  71 Jul  3 01:21 /usr/local/bin/python2.7 -> 
../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
$ /usr/local/bin/python2.7 -c 'import sys;print(sys.executable)'
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

$ ls -l /usr/local/bin/python3.4
lrwxr-xr-x  1 root  wheel  71 Oct  6 16:53 /usr/local/bin/python3.4 -> 
../../../Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4
$ /usr/local/bin/python3.4 -c 'import sys;print(sys.executable)'
/usr/local/bin/python3.4

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22490>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to