构建bsdiff模块失败

0 投票
1 回答
2233 浏览
提问于 2025-04-18 16:59

大家下午好,

我在用Python的bsdiff模块时遇到了一些问题。虽然我可以使用shell脚本,但我更希望能有一个跨平台的解决方案。

我下载了bsdiff4-1.1.4,并尝试运行setup.py,具体操作如下:

文件列表:

bsdiff4  build  CHANGELOG.txt  do.sh  examples  Makefile  README.rst  setup.py

我运行了:

python3 setup.py build

结果出现了这个错误:

/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option:     'entry_points'
  warnings.warn(msg)
running build
running build_py
running build_ext
building 'bsdiff4.core' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g     -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security     -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c bsdiff4/core.c -o build/temp.linux-x86_64-3.4/bsdiff4/core.o
bsdiff4/core.c:8:20: fatal error: Python.h: No such file or directory
#include <Python.h>
                ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

我希望能够用Python对二进制文件应用补丁。

任何帮助都非常感谢。

何塞

1 个回答

2

你需要安装 apt-get install python3-dev

ubuntu python3-dev

这是用于Python的头文件和静态库

如果你是在使用系统自带的Python,你需要加上 sudo

撰写回答