Skip to main content
 首页 » 编程设计

python之无法导入scrapy包

2025年05月04日14java哥

我正在尝试在某些代码中使用 scrapy。但是,我从 Visual Studio Code 收到错误:

无法导入“scrapy”pylint(导入错误)。

我认为这个问题的答案很简单,但我想不通。

使用pip install scrapy后,我打开一个Python控制台,导入scrapy,然后使用scrapy.__ file __找到模块的目录。

我得到了:/anaconda2/lib/python2.7/site-packages/scrapy/__ init __.pyc。

我检查了我的 sys.path,它确实已经包含了 /anaconda2/lib/python2.7/site-packages。怎么了?

请您参考如下方法:

嗯,这很简单。作为Azer mentions in the comments :

If you only get it inside VS Code, then you might have forgotten to set the correct Python interpreter in the VS Code settings.

看起来它只是 VS Code 上的 Python 解释器。