简体   繁体   English

PyCharm 警告未解析的参考内置日期时间模块

[英]PyCharm warns for unresolved reference builtin datetime module

I just installed the latest version of PyCharm (4.5).我刚刚安装了最新版本的 PyCharm (4.5)。

Now I am experiencing unresolved reference errors.现在我遇到了未解决的引用错误。 On the top of my code I have:在我的代码顶部,我有:

from datetime import datetime

OS is Ubuntu 15.04.操作系统是 Ubuntu 15.04。 Already did the Invalidate Cache/Restart several times.已经多次使缓存无效/重新启动。 No difference.没有不同。 The Project interpreter of my project is set to Python 2.7.6.我项目的项目解释器设置为 Python 2.7.6。 Already reloaded the Interperter Paths.已经重新加载了Interperter Paths。

Code works fine, it's just the IDE that produces an annoying error and no more autocomplete.代码工作正常,只是 IDE 产生了一个烦人的错误并且不再自动完成。

As mentioned here try to delete the content of the skeleton folder. 如此处所述尝试删除skeleton文件夹的内容。 It reside inside of the settingsfolder (~/.PyCharmxxxx.xx/system/python_stubs) Removing/adding the python environment was not necessary for me. 它驻留在settingsfolder(〜/ .PyCharmxxxx.xx / system / python_stubs)内部。删除/添加python环境对我来说不是必需的。 Simply restart PyCharm after removing the content (or the whole python_stubs folder) 删除内容(或整个python_stubs文件夹)后,只需重新启动PyCharm

This does the trick for me and now it works like a (py)charm again. 这对我来说很有用,现在它又像(py)魅力一样。

这是已知的,已在https://youtrack.jetbrains.com/issue/PY-15460上报道

Instead of代替

import datetime

Try this尝试这个

from datetime import datetime

Works for me.为我工作。

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

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