Python 未能生成bsdiff模块

Python 未能生成bsdiff模块,python,ubuntu,python-3.x,binary,Python,Ubuntu,Python 3.x,Binary,大家下午好 在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/distuti

大家下午好

在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
/usr/lib/python3.4/distutils/dist.py:260:UserWarning:未知分发选项:“入口点”
警告。警告(msg)
运行构建
运行build\u py
运行build_ext
构建“bsdiff4.core”扩展
x86_64-linux-gnu-gcc-pthread-DNDEBUG-g-fwrapv-O2-Wall-Wstrict原型-g-fstack protector-param=ssp buffer size=4-Wformat-Werror=format security-D_-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:致命错误:Python.h:没有这样的文件或目录
#包括
^
编译终止。
错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1
我希望能够使用python将修补程序应用于二进制文件

谢谢你的帮助


José

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

Python的头文件和静态库


如果是您的系统python,您需要将
sudo

作为旁注,那么使用
pip-install-bsdiff4
安装软件包几乎总是既简单又好。(如果您使用的是系统Python,您可能需要首先检查是否有一个dpkg可以
获得
。)如果您幸运的话,将有一个二进制轮子文件,无需构建即可安装;在最坏的情况下,它的作用与您在一个命令中完成的下载、解压缩和多个
setup.py
步骤相同,并且使以后的卸载或升级更容易。