简体   繁体   English

您如何处理使用PyCharm在Windows下导入内置库?

[英]How do you deal with importing built-in libraries under windows using PyCharm?

I have python-2.6 installed and use pycharm-3.1.3 (community edition) to develop. 我已经安装了python-2.6,并使用pycharm-3.1.3(社区版)进行开发。

But the imports of the built-in libraries (for instance - datetime ) are marked as errors by the given IDE. 但是,给定的IDE将内置库的导入(例如datetime )标记为错误。

在此处输入图片说明

It only happens for built-in libraries, the external ones that are located in <pythondir>/Lib (for instance base64 ) are imported without problems - IDE can resolve symbols from them for intellisense and whatnot. 这仅对于内置库才发生,位于<pythondir>/Lib的外部<pythondir>/Lib (例如base64 )将被导入而不会出现问题<pythondir>/Lib可以解析它们中的符号以进行智能识别和其他操作。

So the question is how to deal with this? 那么问题是如何处理呢?

PS: I know I can mark it as "ignore this import error" but then the library symbols won't be autocompleted. PS:我知道可以将其标记为“忽略此导入错误”,但是库符号不会自动完成。

It happened right after an upgrade from 3.0 to 3.1.x, so probably it's just some upgrade issue. 从3.0升级到3.1.x之后就发生了,因此可能只是一些升级问题。

The solution is to re-add interpreter. 解决方法是重新添加解释器。 After that all built-in modules are resolved fine. 之后,所有内置模块都可以正常解析。

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

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