libgdiplus在MacOS M1上问题:Unable to load shared library ‘libgdiplus‘

libgdiplus在MacOS M1上问题:Unable to load shared library 'libgdiplus'

问题

在mac上的pycharm中执行下面的代码时出现下面的错误

slide.get_thumbnail(
RuntimeError: Proxy error(TypeInitializationException): The type initializer for ‘Gdip’ threw an exception. —> DllNotFoundException: Unable to load shared library ‘libgdiplus’ or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibgdiplus, 0x0001): tried: ‘liblibgdiplus’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OSliblibgdiplus’ (no such file), ‘/opt/anaconda3/envs/deepdoc-only/bin/…/lib/liblibgdiplus’ (no such file), ‘/usr/lib/liblibgdiplus’ (no such file, not in dyld cache), ‘liblibgdiplus’ (no such file), ‘/usr/local/lib/liblibgdiplus’ (no such file), ‘/usr/lib/liblibgdiplus’ (no such file, not in dyld cache)

解决

步骤1

https://docs.aspose.com/cells/zh/net/how-to-install-libgdiplus-in-macos/
按照提示安装

brew install mono-libgdiplus

在MasOS M1上安装完,安装目录是/opt/homebrew/Cellar/mono-libgdiplus/6.1_2/lib,此时在pycharm中运行仍旧是不起作用。

步骤2

在pycharm中修改run configuration,新增一个环境变量environment variables

DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/Cellar/mono-libgdiplus/6.1_2/lib

之后在PyCharm中run代码的时候就可以正常使用了。
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值