Nov-22-2020, 09:56 AM
(This post was last modified: Nov-22-2020, 10:00 AM by Gribouillis.)
You can ask python to where it points. For example in my kubuntu 16.04,
λ python3 Python 3.5.2 (default, Oct 7 2020, 17:19:02) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.executable '/usr/bin/python3'By the way, what about installing packages from within Python itself? You would be certain that they are installed for the current interpreter.
import subprocess as sp import sys def install_package(name): sp.call([sys.executable, '-m', 'pip', 'install', '-U', '--user', name]) if __name__ == '__main__': install_package('requests')