简体   繁体   English

导入ijson模块python时出错

[英]error when importing ijson module python

I need to parse some large (2 Gb+) files into python.我需要将一些大(2 Gb+)文件解析为 python。 I have tried it with the json module but I get a memory error as its methods all load the files at once.我已经用 json 模块尝试过它,但是我得到了一个内存错误,因为它的方法都一次加载了文件。 I then moved on into installing ijson which suposedly implements a iterator-based way of parsing the file.然后我继续安装 ijson,它据称实现了一种基于迭代器的解析文件的方式。 However when I run:但是,当我运行时:

import ijson导入 ijson

I get exception : YAJL shared object not found.我得到异常:未找到 YAJL 共享对象。

Has anyone found a similar issue?有没有人发现类似的问题? any help would be greatly appreciated任何帮助将不胜感激

Regards问候

Thats an easy one, that is because you haven't installed the YAJL C library!那很简单,那是因为您还没有安装 YAJL C 库! ijson is a wrapper around the YAJL without it won't work. ijson 是 YAJL 的包装器,没有它就无法工作。

I installed it via Anaconda and suddenly it started working.我通过 Anaconda 安装了它,突然它开始工作了。

  1. Open Anaconda prompt (win search anaconda)打开 Anaconda 提示(win search anaconda)
  2. run command: conda install ijson运行命令:conda install ijson

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

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