Python 3 sys.exec_prefix wrong
<p>I'm at my wits end here with python3 on Solaris reporting the exec_prefix as <code>/usr/lib</code> instead of <code>/usr</code></p>

<p>This is leading to all sorts of bad behavior when using setup_tools and virtualenv, as they are looking for libraries in <code>/usr/lib/lib/python3.4</code> which is obviously wrong.</p>

<p>We've installed both python2 and python3 packages on Solaris 11.  Python2 is working correctly, while python3 is reporting the wrong exec_prefix.  See below:</p>

<pre><code>    bash-4.1$ env
    TERM=xterm
    PATH=/usr/bin:/bin:/usr/sbin:/sbin
    PWD=/home/user
    SHLVL=1
    _=/usr/bin/env
    bash-4.1$ type -a python3.4
    python3.4 is /usr/bin/python3.4
    python3.4 is /bin/python3.4
    bash-4.1$ type -a python3.4-config
    python3.4-config is /usr/bin/python3.4-config
    python3.4-config is /bin/python3.4-config
    bash-4.1$ python3.4-config --exec-prefix
    /usr
    bash-4.1$ python3.4 -c 'import sys; print(sys.path)'
    ['', '/usr/lib/python34.zip', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-sunos5', '/usr/lib/python3.4/lib-dynload/64', '/usr/lib/python3.4/site-packages', '/usr/lib/python3.4/vendor-packages']
    bash-4.1$ python3.4 -c "import sys; print(sys.prefix, sys.exec_prefix)"
    /usr /usr/lib
    bash-4.1$ grep CONFIG_ARGS /usr/lib/python3.4/config-3.4m/Makefile
CONFIG_ARGS=     'CC=cc -m64 -xO4  -xtarget=ultra2 -xarch=sparcvis
   -xchip=ultra2 -Qoption cg -xregs=no%appl -W2,-xwrap_int
   -xmemalign=16i -mt -KPIC -DPIC -xO5 ' 'CXX=CC' '--prefix=/usr'
   '--mandir=/usr/share/man' '--bindir=/usr/bin/sparcv9'
   '--libdir=/usr/lib/sparcv9' '--sbindir=/usr/sbin/sparcv9'
   '--infodir=/usr/share/info' '--enable-shared' '--with-dtrace'
   '--with-system-expat'
   '--with-system-ffi' '--without-gcc' '--without-ensurepip'
   '--enable-ipv6' '--bindir=/usr/bin' 'CPPFLAGS=-IPython
   -I/usr/include/ncurses -D_LARGEFILE64_SOURCE
   -I/usr/lib/libffi-3.0.9/include  ' 'LDFLAGS=-m64 -KPIC -DPIC
   -xO5 ' 'CFLAGS=-m64 -xO4  -xtarget=ultra2 -xarch=sparcvis
   -xchip=ultra2 -Qoption cg -xregs=no%appl -W2,-xwrap_int
   -xmemalign=16i -mt -KPIC -DPIC -xO5 ' 'DFLAGS=-64'
   'XPROFILE_DIR=../build/sparcv9/.profile'
</code></pre>

<p>I've looked through the python docs, multiple forums and Q&amp;A sites, site.py, and even getpath.c itself.  Nothing explains this behavior.</p>

<p>If I build python3 from source, it works correctly.  However, this isn't an option as I'm not the one who provisions our servers, and the issue occurs with the official Solaris package itself, which we'd like to stay consistent.</p>

<p><strong>TL;DR</strong> - Why would sys.exec_prefix report <code>/usr/lib</code> instead of <code>/usr</code>?</p>

<p>This looks like Solaris bug:</p>

<p>21622699 Python 3.4 mangles sys.exec_prefix, breaks virtualenv</p>

<p>which was fixed in Solaris 12 but has not yet been back-ported to 11.3; I will see about making that happen.</p>

python python-3.x solaris