简体   繁体   English

PyCharm:智能感知或自动完成不适用于 Python 3.5.2

[英]PyCharm: Intellisense or auto-complete not working with Python 3.5.2

I have recently installed Python 3.5.2 then PyCharm (IDE), but intellisense or auto-complete not working in my Windows 10.我最近安装了 Python 3.5.2 然后 PyCharm (IDE),但智能感知或自动完成在我的 Windows 10 中不起作用。

# Method 1: intellisense or auto-complete not working for below
city = input("Enter your City \n")
print(city)
print(city.)     *#<<<--- here not working when put a "." after "city"* variable

快照 1

...but surprised to see that it works fine with below code: ...但惊讶地发现它在以下代码中运行良好:

myCity = "New York City"
print(myCity.upper())

快照 2

Finally it working now:最后它现在工作:

  1. I had to install the Python 3.4.1 for my PyCharm 2016.3.2我必须为我的PyCharm 2016.3.2安装Python 3.4.1

  2. Go to File menu >> Settings... >> Project: Python Programs >> Project Interpreter >> now follow below screenshot:转到File菜单>> Settings... >> Project: Python Programs >> Project Interpreter >>现在按照以下屏幕截图:

截屏

...but not sure that why it was not working with Python 3.5? ...但不确定为什么它不适用于 Python 3.5? ---> Thank you to @Pavel Karateev for the helpful update. ---> 感谢@Pavel Karateev 提供的有用更新。

The value that input may give you may have any type. input可能给你的值可能是任何类型。 That is, if you happen to type {"a": 1} , the return type of input will be dict .也就是说,如果您碰巧键入{"a": 1}input的返回类型将是dict Test it.测试一下。

So with input all attribute inference is moot.因此,对于input ,所有属性推断都没有实际意义。 The completions offered are not even attributes, it seems, but expression modifiers.提供的补全似乎甚至不是属性,而是表达式修饰符。

If you only want to input a string value, use raw_input .如果您只想输入字符串值,请使用raw_input The result should be considered a string, and attribute completion should work.结果应该被认为是一个字符串,并且属性完成应该工作。

To see it work, type:要查看它是否有效,请键入:

city_name = raw_input("What is your city? ")
city_name.l

Then press the completion key after the l ;然后按l后的完成键; i suppose you will be offered variants like lower() and lstrip() .我想你会得到像lower()lstrip()这样的变体。 This would mean that PyCharm understood that city_name must be a string, and offers relevant methods.这意味着 PyCharm 理解city_name必须是一个字符串,并提供相关的方法。

Another answer is:另一个答案是:

I was facing the same problem because mistakenly I had turned on the Power Save Mode in PyCharm.我遇到了同样的问题,因为我错误地在 PyCharm 中打开了省电模式。 To turn it Off go to File -> Power Save Mode .要关闭它,请转到File -> Power Save Mode It solved my issue.它解决了我的问题。 Thanks谢谢

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

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