Python 3 sys.exec_prefix 错误

标签 python python-3.x solaris

Solaris 上的 python3 将 exec_prefix 报告为 /usr/lib 而不是 /usr

我已经无计可施了

这会导致在使用 setup_tools 和 virtualenv 时出现各种不良行为,因为它们正在寻找 /usr/lib/lib/python3.4 中的库,这显然是错误的。

我们已经在 Solaris 11 上安装了 python2 和 python3 包。Python2 工作正常,而 python3 报告错误的 exec_prefix。见下文:

    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'

我浏览了 python 文档、多个论坛和问答网站、site.py,甚至 getpath.c 本身。无法解释这种行为。

如果我从源代码构建 python3,它可以正常工作。但是,这不是一个选项,因为我不是配置我们服务器的人,而且问题出在官方 Solaris 软件包本身,我们希望保持一致。

TL;DR - 为什么 sys.exec_prefix 报告 /usr/lib 而不是 /usr

最佳答案

这看起来像 Solaris 错误:

21622699 Python 3.4 破坏 sys.exec_prefix,破坏 virtualenv

已在 Solaris 12 中修复,但尚未向后移植到 11.3;我会设法实现这一点。

关于Python 3 sys.exec_prefix 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39237407/

相关文章:

Python lxml iterfind 带命名空间但前缀=无

python - 使用 Python 更快地 gzip 文件?

python - 使用 CSV 模块解析 CSV 字符串

python - Django Rest Framework -- 没有名为 rest_framework 的模块

c - strftime 没有使用 %C 选项给出正确的输出 - Solaris 10

c - pclose() 在多线程环境中过早返回 (Solaris 11)

python根据日期创建目录结构

python - GAE(python)如何需要接收邮件并在留言板上发布然后向所有用户发送邮件?

python - simple-salesforce 无法识别自定义对象

c++ - Solaris 上的空核心文件