Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复Google Cloud Vision的分段错误?_Python_Raspberry Pi_Segmentation Fault_Google Cloud Vision - Fatal编程技术网

Python 如何修复Google Cloud Vision的分段错误?

Python 如何修复Google Cloud Vision的分段错误?,python,raspberry-pi,segmentation-fault,google-cloud-vision,Python,Raspberry Pi,Segmentation Fault,Google Cloud Vision,我正在使用Google Cloud Vision API检测从pi摄像头拍摄的图像,如果检测到的图像是动物,它将删除该图像,如果不是,它将运行另一个名为takePicture(image_name)的函数。我的脚本工作得非常好,但大多数时候我都会遇到一个奇怪的问题,称为分段错误,当发生这种情况时,它不会中断我的python程序,但我的4x4键盘(连接到RPi)停止工作,并且还会自动创建另一个python程序的循环进程,该进程即使在“键盘中断”的情况下仍在运行 有可能是旧硬件的问题吗?因为我使用的

我正在使用Google Cloud Vision API检测从pi摄像头拍摄的图像,如果检测到的图像是动物,它将删除该图像,如果不是,它将运行另一个名为takePicture(image_name)的函数。我的脚本工作得非常好,但大多数时候我都会遇到一个奇怪的问题,称为分段错误,当发生这种情况时,它不会中断我的python程序,但我的4x4键盘(连接到RPi)停止工作,并且还会自动创建另一个python程序的循环进程,该进程即使在“键盘中断”的情况下仍在运行

有可能是旧硬件的问题吗?因为我使用的是Raspberry Pi模型B和python 2.7

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 000e
Serial          : 0000000095fec982

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

当python程序试图使用超出范围的内存时,就会出现分段错误。这意味着它没有所需的资源


查看答案,并尝试找出发生的时间点。我想这可能是因为你的raspberry pi提供的低计算能力。也许您可以使用分配更多。

我使用:ulimit-s 16384,这是最大值,但没有解决分段故障。
pi@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 000e
Serial          : 0000000095fec982

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"