MemoryError: Cannot allocate write+execute memory for ffi.callback()

本机环境:mac air、macOS12.2、python3.9.6

问题描述

使用scrapy crawl xxx(xxx是我的项目名) 命令爬虫时出现错误:MemoryError: Cannot allocate write+execute memory for ffi.callback(). You might be running on a system that prevents this. For more information, see https://cffi.readthedocs.io/en/latest/using.html#callbacks

最终解决方案

只需将python版本升级为3.10.2,然后重新安装scrapy,问题即可解决!!

参考自github的issue:

Figured it out following @anribras 's advice. M1 mac, had the same issue here. As @anribras says, I upgraded Python in my conda env to 3.10.2 and now this issue is resolved.
链接: github.

其他解决方案

1、更新requests库,我尝试后不行。

pip3 install --upgrade requests
参考链接:stackflow

2、删除pyopenssl库,由于我是因为使用scrapy库出现的这个错误,而scrapy库又依赖于pyopenssl库,所以我删除之后依然不行。

pip3 uninstall pyopenssl
参考链接:CSDN

参考链接:
1.https://github.com/pyca/pyopenssl/issues/873#issuecomment-1072969241
2.https://stackoverflow.com/questions/67556847/scrapy-on-m1-mac-memoryerror-cannot-allocate-writeexecute-memory-for-ffi-call
3.https://blog.csdn.net/hrbust_cxl/article/details/115283524

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值