简体   繁体   English

在 Pycharm 上为 Python 导入 json

[英]Importing json on Pycharm for Python

I am trying to import json using pycharm, but it keeping underlining the json as an error with the quote'unresolved statement'我正在尝试使用 pycharm 导入 json,但它始终将 json 下划线作为带有引用“未解析语句”的错误

And I have installed the latest version of json.我已经安装了最新版本的 json。

Since you didn't provide much info here is a wild guess:由于您没有提供太多信息,因此这里是一个疯狂的猜测:

make sure (or add) site-packages in PyCharm is included in your Project Scope: File - Settings - Project: Name - Project Structure - +Add Content Root确保(或添加)PyCharm 中的站点包包含在您的项目范围中:文件 - 设置 - 项目:名称- 项目结构 - +添加内容根

The path will be something like this: C:\\Program Files (x86)\\Python\\Python37\\Lib\\site-packages路径将是这样的:C:\\Program Files (x86)\\Python\\Python37\\Lib\\site-packages

and make sure you actually import the json lib by: "import json" at the beginning of your code.并确保通过以下方式实际导入 json 库:在代码的开头“导入 json”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM