ger*_*com 8 python macos homebrew reportlab
我有一个 Django 项目,使用 easy-thumbnail 作为依赖项。
使用 pip 安装所有软件包按预期工作,但是当我尝试运行我的应用程序时,出现此错误:
Invalid template library specified. ImportError raised when trying to load 'backend.templatetags.get_thumbnail': dlopen(/opt/homebrew/lib/python3.9/site-packages/reportlab/graphics/_renderPM.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_FT_Done_Face'
Run Code Online (Sandbox Code Playgroud)
该错误是从 reportlab 引发的,它是 easy-thumbnail 的依赖项。据我了解,reportlab 无法找到 freetype。但恕我直言,它安装正确。
我使用的是 macOS 12.0.1
我通过 Homebrew 安装了 Python 和 freetype。pkg-config 表示,freetype2 在预期路径中可用。
我究竟做错了什么?我怎样才能解决这个问题?
编辑
我otool -l对失败的 .so 文件做了处理,这就是我得到的(这里我在 venv 中再次运行它):
/Users/markusgerards/.pyenv/versions/myapp/lib/python3.9/site-packages/reportlab/graphics/_renderPM.cpython-39-darwin.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
Run Code Online (Sandbox Code Playgroud)
我怀疑 freetype 应该列在那里......对吧?
ger*_*com 14
我使用以下命令重新安装了reportlab:
pip install reportlab --force-reinstall --no-cache-dir --global-option=build_ext
Run Code Online (Sandbox Code Playgroud)
这迫使 pip 实际构建包,现在一切都按预期工作!
小智 5
我使用 M1 Mac Air 和 Python 3.8,由于某种原因,@gerricom 的解决方案对我来说不起作用。但是,简单pip uninstall reportlab然后就pip install reportlab解决了问题。
| 归档时间: |
|
| 查看次数: |
8416 次 |
| 最近记录: |