我正在尝试使用一个小脚本来获取特定时期的instagram帖子
这就是代码:
from datetime import datetime
from itertools import dropwhile, takewhile
import instaloader
# Get instance
L = instaloader.Instaloader()
posts = instaloader.Profile.from_username(L.context, PROFILE).get_posts()
SINCE = datetime(2019, 4, 1)
UNTIL = datetime(2015, 4, 23)
for post in takewhile(lambda p: p.date > UNTIL, dropwhile(lambda p: p.date > SINCE, posts)):
print(post.date)
L.download_post(post)当脚本运行时,只打印以下内容:module 'instaloader' has no attribute 'Instaloader'
是的,我已经安装了模块。
发布于 2019-08-02 16:08:54
如果您的项目名称是lib,请尝试将其重命名为不同的名称,因为它与instaloader.py的名称相同。
发布于 2019-06-24 17:52:29
如果您在ipython (Jupyter)或Idle上运行,则它们可能使用默认的python环境,而不是运行命令的virtualenv。
有关ipython (Jupyter),请参阅this。
对于空闲使用:
(venv)$ python -m idlelib.idle file.pyhttps://stackoverflow.com/questions/55843410
复制相似问题