【发布时间】:2018-12-24 16:09:56
【问题描述】:
第一次在 VS Code 中使用 Python。我的导入未被识别,即随机?
我已经在 Anaconda Jupyter 中运行了我的代码,所以我知道我的代码可以正常工作。是配置问题。
import random
num = random.randint(1,2)
我希望没有运行时错误。
但我在控制台中得到以下响应:
num = random.randint(1,2) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'random' is not defined
【问题讨论】:
标签: python python-3.x visual-studio-code