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代码的时候就可以正常使用了。

相关推荐
纤纡.18 小时前
基于 PyTorch 手动实现 CBOW 词向量训练详解
人工智能·pytorch·python·深度学习
词元Max18 小时前
2.5 Python 类型注解与运行时类型检查
开发语言·python
沪漂阿龙18 小时前
深度解析Pandas数据组合:从concat到merge,打通你的数据处理任督二脉
python·数据分析·pandas
童园管理札记19 小时前
2026实测|GPT-4.5+Agent智能体:3小时搭建企业级客服系统,附完整源码与部署教程(一)
经验分享·python·深度学习·重构·学习方法
大飞记Python19 小时前
【2026更新】Python基础学习指南(AI版)——安装
自动化测试·python·ai编程
AI街潜水的八角19 小时前
YOLO26手语识别项目实战1-三十五种手语实时检测系统数据集说明(含下载链接)
python·深度学习
2401_8274999919 小时前
python核心语法03-数据存储容器
开发语言·python
哈伦201919 小时前
第一章 Jupyter Notebook基础实操
python·jupyter·基础操作
人道领域19 小时前
2026技术展望】Python与AI的深度融合:从“能用”到“好用”的质变之年
人工智能·python·大模型·agent
chushiyunen19 小时前
python异常模拟工具类(异常生成工具类)
开发语言·python