简体   繁体   English

pycharm 内置未解决的参考

[英]pycharm builtin unresolved reference

I'm using PyCharm and just trying out some simple stuff.我正在使用 PyCharm 并尝试一些简单的东西。 When I try to use raw_input() , the editor is showing an unresolved reference error.当我尝试使用raw_input()时,编辑器显示未解决的引用错误。

I'm not sure what the issue is.我不确定是什么问题。 Has anyone seen this before?有没有人见过这个?

You have the language version set to Python 3;您已将语言版本设置为 Python 3; raw_input in Python 2 is just input in Python 3 ( input in Python 2 is eval(input()) in Python 3: What's the difference between raw_input() and input() in python3.x? ). raw_input在Python 2只是input在Python 3( input在Python 2 eval(input())在Python 3: ?什么的raw_input()和输入()在python3.x之间的差异)。

To select the Python version, see: How to select Python version in PyCharm?要选择 Python 版本,请参阅: 如何在 PyCharm 中选择 Python 版本?

I was getting a similar issue.我遇到了类似的问题。 @property and ValueError were being shown as 'undefined'. @propertyValueError显示为“未定义”。 I had mucked about with PyCharm's interpreter settings a bit beforehand, and I was able to fix it by using the File -> Invalidate Caches / Restart... and choosing the "Invalidate and Restart" command.我事先对 PyCharm 的解释器设置进行了处理,我能够通过使用 File -> Invalidate Caches / Restart... 并选择“Invalidate and Restart”命令来修复它。

In my case, I was getting the same error message when I tried:就我而言,我在尝试时收到了相同的错误消息:

variable = print("Some Text")

The problem is double quotes, single quotes will solve the problem as follows:问题是双引号,单引号会解决问题,如下:

variable = print('Some text')

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

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