Installation location for python code, tools, etc.
Bill Cole
macportsusers-20171215 at billmail.scconsult.com
Sun Jan 2 22:16:39 UTC 2022
On 2022-01-02 at 16:23:34 UTC-0500 (Sun, 2 Jan 2022 16:23:34 -0500)
Forrest Aldrich <forrie at gmail.com>
is rumored to have said:
> 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/
This is how MacPorts supports simultaneous installs of different Python
versions. You may note that there are versioned python symlinks in
/opt/local/bin pointing to that path and possibly an additional bunch of
symlinks making 'python' and 'python3' go there. If you install the
python_select and python3_select ports, they will create links in
/opt/local/bin if you run 'port select python' or 'port select python3'
that ultimately resolve to that versioned path.
When you install a Python module outside of MacPorts, its installer is
almost certain to not know to create those links.
> I'm suspecting an environment variable.
I believe that *in theory* you should get binaries into
/opt/local/(s)bin/ if you set the PYTHONHOME environment variable to
'/opt/local/Library/Frameworks/Python.framework/Versions/3.9:/opt/local'
when running setup.py or pip.
--
Bill Cole
bill at scconsult.com or billcole at apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire
More information about the macports-users
mailing list