anaconda出现AttributeError: dlsym(RTLD_DEFAULT, AbsoluteToNanoseconds): symbol not found

1、问题描述

安装anaconda,测试conda时,出现 AttributeError: dlsym(RTLD_DEFAULT, AbsoluteToNanoseconds): symbol not found错误

2、问题定位

mac系统版本为11.2.3;目前anaconda还不支持。

这是macOS Big Sur 11.0.1系统新增的功能,它带有所有系统提供的库的内置动态链接器缓存。 作为此更改的一部分,文件系统上不再存在动态库的副本。 试图通过在路径中查找文件或枚举目录来检查动态库是否存在的代码将失败。 而是尝试通过dlopen()路径检查库是否存在,这将正确检查高速缓存中的库。 

3、解决方法

为了找到这些库,在<Python 2安装路径> /lib/python2.7/ctypes/util.py中os.name ==“ posix” and sys.platform ==“ darwin”:后面的find_library函数设置静态路径,即添加下面代码:

if name == 'CoreServices':
    return '/System/Library/Frameworks/CoreServices.framework/CoreServices'
elif name == 'libSystem.dylib':
    return '/usr/lib/libSystem.dylib'

最后整个代码块如下所示:

if os.name == "posix" and sys.platform == "darwin":
    from ctypes.macholib.dyld import dyld_find as _dyld_find
    def find_library(name):
        if name == 'CoreServices':
            return '/System/Library/Frameworks/CoreServices.framework/CoreServices'
        elif name == 'libSystem.dylib':
            return '/usr/lib/libSystem.dylib'

        possible = ['@executable_path/../lib/lib%s.dylib' % name,
                    'lib%s.dylib' % name,
                    '%s.dylib' % name,
                    '%s.framework/%s' % (name, name)]
        for name in possible:
            try:
                return _dyld_find(name)
            except ValueError:
                continue
        return None

参考网址

https://stackoverflow.com/questions/65130080/attributeerror-running-django-site-on-mac-11-0-1

 

  • 9
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值