ImportError when installing newspaper

2020-03-05 06:12发布

I am pretty new to python and am trying to import newspaper for article extraction. Whenever I try to import the module I get ImportError: cannot import name images. Anyone come across this problem and found a solution?

2条回答
Anthone
2楼-- · 2020-03-05 07:14

I was able to fix this problem by creating an images directory in /usr/local/lib/python2.7/dist-packages/newspaper , moving images.py to this directory, and placing a blank __init__.py in this directory.

查看更多
我只想做你的唯一
3楼-- · 2020-03-05 07:15

I know this is a dated entry, but to anyone else that faced the same issue as me, I initially fumbled with resolving this issue. When I first run import newspaper, I faced this error. lxml runtime error: Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0

When I tried to re-run my code (without correcting anything), I got the error found on this article. I have no idea why this was the case, and I wasn't able to resolve my issue using the above method (it didn't work for me, but it could still work for you). If anyone was fumbling like me on Jupyter on getting newspaper to work, do consider the link below. Hope this is helpful.

https://stackoverflow.com/a/31607751/6143792

查看更多
登录 后发表回答