Open aCoo4ie opened 7 months ago
似乎不是mac系统的问题,而是M芯片的问题。我试着用arch -x86_64 还没有成功,目前还是在用intel芯片的机子跑
Same issue on a M3 mac.
brew install cairo
~/.bashrc
或 ~/.zshrc
)
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH"
export DYLD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$DYLD_LIBRARY_PATH"
source ~/.bashrc
或 source ~/.zshrc
根据你上面更改的配置文件
brew install cairo
- 添加如下两行到你的终端配置文件(一般是
~/.bashrc
或~/.zshrc
)export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH" export DYLD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$DYLD_LIBRARY_PATH"
source ~/.bashrc
或source ~/.zshrc
根据你上面更改的配置文件
感谢 完美解决在m芯片mac下运行的问题
按照文档,运行后出现以下错误提示: Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/acookie/Desktop/weread-exporter/weread_exporter/main.py", line 158, in
main()
File "/Users/acookie/Desktop/weread-exporter/weread_exporter/main.py", line 154, in main
loop.run_until_complete(async_main())
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 684, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/acookie/Desktop/weread-exporter/weread_exporter/main.py", line 17, in async_main
from . import export, utils, webpage
File "/Users/acookie/Desktop/weread-exporter/weread_exporter/export.py", line 12, in
from weasyprint import HTML, CSS
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weasyprint/init.py", line 469, in
from .css import preprocess_stylesheet # noqa isort:skip
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weasyprint/css/init.py", line 27, in
from . import computed_values, counters, media_queries
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weasyprint/css/computed_values.py", line 15, in
from .. import text
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/weasyprint/text.py", line 11, in
import cairocffi as cairo
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cairocffi/init.py", line 47, in
cairo = dlopen(
^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/cairocffi/init.py", line 44, in dlopen
raise OSError(error_message) # pragma: no cover
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': dlopen(libcairo.so.2, 0x0002): tried: 'libcairo.so.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo.so.2' (no such file), '/usr/lib/libcairo.so.2' (no such file, not in dyld cache), 'libcairo.so.2' (no such file), '/usr/lib/libcairo.so.2' (no such file, not in dyld cache). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.so.2'
cannot load library 'libcairo.2.dylib': dlopen(libcairo.2.dylib, 0x0002): tried: 'libcairo.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache), 'libcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.2.dylib'
cannot load library 'libcairo-2.dll': dlopen(libcairo-2.dll, 0x0002): tried: 'libcairo-2.dll' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo-2.dll' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache), 'libcairo-2.dll' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo-2.dll'