这是由于macOS Montery升级修改了系统库路径的格式,导致gfortran无法找到所需的库文件。解决方法是手动将gfortran链接到正确的库文件路径。在终端中运行以下命令:
ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd.old
ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.dylib.old
这将会创建两个软链接,将原本的libSystem.tbd和libSystem.dylib链接到gfortran所需的库文件路径中。重新编译你的代码,问题应该就能够得到解决了。
上一篇:安装了lxml后,在使用另一个函数时出现了TypeError。
下一篇:安装了macports后仍然出现“OSError: no library called "cairo" error”错误。