诗上的ImportError但已安装模块

时间:2020-08-19 16:38:01

标签: python visual-studio-code python-poetry

我正在将诗歌与VSCode一起使用,并且在运行此代码时遇到了错误

no debugging symbols

错误是

import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions

with beam.Pipeline(options=PipelineOptions()) as p:
    pass  # build your pipeline here

我的Traceback (most recent call last): File "/path/to/pipeline.py", line 2, in <module> import apache_beam as beam ImportError: No module named apache_beam

pyproject.toml

当我运行[tool.poetry.dependencies] python = "^3.7" pytest = "^5.4.3" apache-beam = "^2.23.0" 时,我只会得到这个

poetry install

这使我认为➜ poetry install Installing dependencies from lock file No dependencies to install or update 已正确安装。

我正在使用VSCode,并使用这些文章(part Ipart II)作为设置诗歌的指南。

要启动VSCode,我先运行了apache-beam,然后运行了poetry shell,如本文所建议。

可能有帮助的其他信息:

code .

我不知道为什么这不起作用,并且花了几个小时来解决,所以任何建议都将不胜感激?

编辑:

我根据this文章安装了python,我认为这可能会干扰Poetry创建的virtualenv

1 个答案:

答案 0 :(得分:0)

除了VSCode之外,我不知道要使用哪个Python环境,我将手动检查是否已通过pip安装了Beam或查看venv本身中的软件包。