I'm not very experienced with Python, yet, but with regard to MacPorts,
I'm trying to understand why when I do a pip3 install, or a direct
install from a project tree ie: "python setup.py install" the tool(s)
end up in this directory instead of /opt/local/bin|sbin etc:

/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/

Python is typically built as a framework on macOS, so that's where the modules go. See <https://github.com/python/cpython/blob/main/Mac/README.rst>.

% python3.9
Python 3.9.9 (main, Nov 16 2021, 17:57:38)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.prefix
'/opt/local/Library/Frameworks/Python.framework/Versions/3.9'

Pip has a number of options controlling where things are installed: <https://pip.pypa.io/en/stable/cli/pip_install/#options>

I strongly recommend not installing modules into the MacPorts prefix with pip (or manually), because modules installed in other ways will conflict with modules installed by MacPorts. Install in a venv, or use pip's --user option or some completely separate prefix.

- Josh

Reply via email to