Cross-platform way to get default directory for Python console scripts?
Question: Is there cross-platform way to get default directory for console scripts the
same way one can use `sys.executable` to get path to the Python's interpreter
in cross-platform way?

Context:  
There's Python script which runs various tools like pip using subprocess
module and it would be good to make sure to run tools that accompany Python's
interpreter used to run this script. Please note that the script may be run
from within virtualenv which had not been activated – `./venv/bin/python
script.py`


Answer: Yes, [`sysconfig`](http://docs.python.org/3.3/library/sysconfig.html) module
provides such API through
[`get_path()`](http://docs.python.org/3.3/library/sysconfig.html#sysconfig.get_path)
function:

Linux:

    
    
    pdobrogost@host:~/tmp$ venv/bin/python -c "import sysconfig; print(sysconfig.get_path('scripts'))"
    /home/users/pdobrogost/tmp/venv/bin
    

Windows:

    
    
    X:\>venv\Scripts\python.exe -c "import sysconfig; print(sysconfig.get_path('scripts'))"
    X:\venv\Scripts
    

References:  
<https://groups.google.com/forum/#!topic/comp.lang.python/s3vLkVy2xJk>  
<https://mail.python.org/pipermail/distutils-sig/2014-February/023867.html>

Thank you Ned Batchelder, Oscar Benjamin, Paul Moore and Vinay Sajip for help.

