【发布时间】:2020-11-05 04:59:29
【问题描述】:
我的代码中有 import simplejson,并使用 pip install simplejson using python3 安装 所以当我检查时,它完美地在我打开文件的终端中运行,但是当我尝试在 VScode 中构建时,它显示一个错误,例如, see the error in this link作为
`> 执行任务:python /Users/Tony/Documents/python3.9/helloworld.py
Traceback(最近一次调用最后一次): 文件“/Users/Tony/Documents/python3.9/helloworld.py”,第 1 行,在 将 simplejson 导入为 json ImportError:没有名为 simplejson 的模块 终端进程“/bin/bash '-c', 'python /Users/Tony/Documents/python3.9/helloworld.py'”启动失败(退出代码:1)。
但它仍然在我的终端上运行。如果我检查 pip 列表,simplejson 仍然存在,我也尝试使用不同版本的 python。
我已经激活了虚拟环境enter image description here 我正在使用我最近激活的最后一个。
请帮我找出错误。我真的不知道在哪里解决谢谢
【问题讨论】:
-
您知道 simplejson 不仅仅是标准库中内置的 json 模块的外部维护版本吗?这是早期 Python 2 版本中的事情。但是现在你应该考虑使用 json 模块。
-
感谢您提供的信息!我对 python 很陌生,只是按照我支付的教程中的步骤操作......所以.. :( 但是谢谢!
标签: python visual-studio-code import simplejson