macOS M1安装wxPython报错‘tiff.h‘ file not found的解决方法

macOS12.6.6 M1安装wxPython失败:

报错如下:

imagtiff.cpp:37:14: fatal error: 'tiff.h' file not found

解决办法:

下载源文件重新编译(很快,5分钟全部搞定),分三步走:

第一步:下载源文件并解压,然后修改2个源文件

pip download wxPython==4.1.1
tar -zxvf wxPython-4.1.1.tar.gz
cd ./wxPython-4.1.1/ext/wxWidgets/src/common/
vim imagtiff.cpp

修改这4句头文件:
在这里插入图片描述

#include "../tiff/libtiff/tiff.h"
#include "../tiff/libtiff/tiffio.h"
    //#include "tiff.h"
    //#include "tiffio.h"

保存退出,然后

cd ./wxPython-4.1.1/ext/wxWidgets/src/tiff/libtiff/
vim tiff.h

修改这一句:
在这里插入图片描述

#include "tiffconf.h"

保存退出,OK

第二步:进入重新编译

cd ./wxPython-4.1.1
python3 setup.py build

第三步:再次安装

python3 setup.py install

搞定,下面是安装成功的消息:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42183962/article/details/134109000