简体   繁体   English

Python 在树莓派上编译失败

[英]Python fails to compile on Raspberry Pi

I am trying to compile Python 3.6 on Raspberry Pi Jessie following the instructions here and I am getting the following error:我正在尝试按照此处的说明在 Raspberry Pi Jessie 上编译 Python 3.6,但出现以下错误:

running build_scripts运行 build_scripts
creating build/scripts-3.6创建 build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/pydoc3 -> build/scripts-3.6复制和调整 /home/pi/Downloads/Python-3.6.12/Tools/scripts/pydoc3 -> build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/idle3 -> build/scripts-3.6复制和调整 /home/pi/Downloads/Python-3.6.12/Tools/scripts/idle3 -> build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/2to3 -> build/scripts-3.6复制和调整 /home/pi/Downloads/Python-3.6.12/Tools/scripts/2to3 -> build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/pyvenv -> build/scripts-3.6复制和调整 /home/pi/Downloads/Python-3.6.12/Tools/scripts/pyvenv -> build/scripts-3.6
changing mode of build/scripts-3.6/pydoc3 from 644 to 755将 build/scripts-3.6/pydoc3 的模式从 644 更改为 755
changing mode of build/scripts-3.6/idle3 from 644 to 755将 build/scripts-3.6/idle3 的模式从 644 更改为 755
changing mode of build/scripts-3.6/2to3 from 644 to 755将 build/scripts-3.6/2to3 的模式从 644 更改为 755
changing mode of build/scripts-3.6/pyvenv from 644 to 755将 build/scripts-3.6/pyvenv 的模式从 644 更改为 755
renaming build/scripts-3.6/pydoc3 to build/scripts-3.6/pydoc3.6将 build/scripts-3.6/pydoc3 重命名为 build/scripts-3.6/pydoc3.6
renaming build/scripts-3.6/idle3 to build/scripts-3.6/idle3.6将 build/scripts-3.6/idle3 重命名为 build/scripts-3.6/idle3.6
renaming build/scripts-3.6/2to3 to build/scripts-3.6/2to3-3.6将 build/scripts-3.6/2to3 重命名为 build/scripts-3.6/2to3-3.6
renaming build/scripts-3.6/pyvenv to build/scripts-3.6/pyvenv-3.6将 build/scripts-3.6/pyvenv 重命名为 build/scripts-3.6/pyvenv-3.6
Segmentation fault分段故障
Makefile:603: recipe for target 'sharedmods' failed Makefile:603:目标“sharedmods”的配方失败
make[2]: *** [sharedmods] Error 139 make[2]: *** [sharedmods] 错误 139
make[2]: Leaving directory '/home/pi/Downloads/Python-3.6.12' make[2]: 离开目录'/home/pi/Downloads/Python-3.6.12'
Makefile:496: recipe for target 'build_all_generate_profile' failed Makefile:496:目标“build_all_generate_profile”的配方失败
make[1]: *** [build_all_generate_profile] Error 2 make[1]: *** [build_all_generate_profile] 错误 2
make[1]: Leaving directory '/home/pi/Downloads/Python-3.6.12' make[1]: 离开目录'/home/pi/Downloads/Python-3.6.12'
Makefile:477: recipe for target 'profile-opt' failed Makefile:477:目标“profile-opt”的配方失败
make: *** [profile-opt] Error 2 make: *** [profile-opt] 错误 2

I am getting the same errors when trying to compile any 3.6.x or 3.8.x Python version.尝试编译任何 3.6.x 或 3.8.x Python 版本时,我遇到了同样的错误。

Any idea what the problem could be?知道问题可能是什么吗?

To build python from source you need the development packages needed to install python.要从源代码构建 python,您需要安装 python 所需的开发包。

This is how to install them:这是安装它们的方法:

$ sudo apt update

$ sudo apt install build-essential zlib1g-dev \ libncurses5-dev libgdbm-dev libnss3-dev \ libssl-dev libreadline-dev libffi-dev curl

Then follow the rest of the instructions given to you.然后按照给你的说明进行操作。

When you trying to compile Python on Debian 8 you have to follow instructions exactly.当您尝试在 Debian 8 上编译 Python 时,您必须完全按照说明进行操作。 For some reason if you running 'make -j 2' you would get this errors but while you running just 'make' it compiling as intended出于某种原因,如果您运行“make -j 2”,您会收到此错误,但是当您运行“make”时,它会按预期编译

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM