Conda是如何解决Linux系统下动态链接库依赖问题的?

我发现在Linux上安装Conda之后,如果使用conda create命令创建一个新的环境,那么下载的解释器应当是无需编译的。但是,既然无需编译,那…
关注者
5
被浏览
659

1 个回答

conda 中的python的编译器都是被魔改过的, 加入了RPATH字段。可以查看conda环境中的RPATH

readelf -d ~/miniconda3/bin/python3.9
Dynamic section at offset 0x30f2b0 contains 28 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib]
 0x000000000000000c (INIT)               0x41f000
 0x000000000000000d (FINI)               0x610044
 0x0000000000000004 (HASH)               0x4002e8
 0x000000006ffffef5 (GNU_HASH)           0x4032c8
 0x0000000000000005 (STRTAB)             0x4124c8
 0x0000000000000006 (SYMTAB)             0x406510
 0x000000000000000a (STRSZ)              37820 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x7104c0
 0x0000000000000002 (PLTRELSZ)           24 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x41eba0
 0x0000000000000007 (RELA)               0x41c9e0
 0x0000000000000008 (RELASZ)             8640 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)