Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66760
| References | <405ad1dc-691e-4c71-adfd-c19c599ad555@googlegroups.com> |
|---|---|
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
| Date | 2014-02-20 15:22 +0000 |
| Subject | Re: Cross-platform way to get default directory for binary files like console scripts? |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7188.1392909800.18130.python-list@python.org> (permalink) |
On 20 February 2014 14:27, Piotr Dobrogost <p@google-groups-2014.dobrogost.net> wrote: > Is there cross-platform way to get default directory for binary files (console scripts for instance) 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 and we would like to make sure we 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 our_script.py I'm not sure if I understand the question. Are you trying to find where a script would go if it had been installed as a result of 'python setup.py install' or 'pip install ...'? If so there are different places it could go depending not only on the system but also how the packages were installed (e.g. --user). You can find the default location in this roundabout way: In [1]: from distutils.command.install import install In [2]: from distutils.dist import Distribution In [3]: c = install(Distribution()) In [4]: c.finalize_ c.finalize_options c.finalize_other c.finalize_unix In [4]: c.finalize_options() In [5]: c.insta c.install_base c.install_headers c.install_lib c.install_path_file c.install_platlib c.install_scripts c.install_usersite c.install_data c.install_layout c.install_libbase c.install_platbase c.install_purelib c.install_userbase In [5]: c.install_scripts Out[5]: '/usr/local/bin' Oscar
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cross-platform way to get default directory for binary files like console scripts? Piotr Dobrogost <p@google-groups-2014.dobrogost.net> - 2014-02-20 06:27 -0800
Re: Cross-platform way to get default directory for binary files like console scripts? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-20 10:11 -0500
Re: Cross-platform way to get default directory for binary files like console scripts? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-20 15:22 +0000
Re: Cross-platform way to get default directory for binary files like console scripts? Piotr Dobrogost <p@google-groups-2014.dobrogost.net> - 2014-02-20 07:34 -0800
Re: Cross-platform way to get default directory for binary files like console scripts? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-20 10:42 -0500
Re: Cross-platform way to get default directory for binary files like console scripts? Piotr Dobrogost <p@google-groups-2014.dobrogost.net> - 2014-02-20 07:55 -0800
Re: Cross-platform way to get default directory for binary files like console scripts? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-20 15:44 +0000
Re: Cross-platform way to get default directory for binary files like console scripts? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-20 15:55 +0000
Re: Cross-platform way to get default directory for binary files like console scripts? Ned Batchelder <ned@nedbatchelder.com> - 2014-02-20 11:26 -0500
Re: Cross-platform way to get default directory for binary files like console scripts? Piotr Dobrogost <p@google-groups-2014.dobrogost.net> - 2014-02-21 06:12 -0800
csiph-web