解决 PyDev 中 Python 模块警告的无效名称 [英] Solving the invalid name for Python module warning in PyDev

查看:57
本文介绍了解决 PyDev 中 Python 模块警告的无效名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 PyDev 中遇到了 Invalid name for Python module: ...filename (it's not be analysis) 警告消息,我尝试通过替换 - 在带有 _ 的文件名中,但警告没有消失.

I encountered the Invalid name for Python module: ...filename (it'll not be analyzed) warning message in PyDev and I tried to resolve it by replacing - in the filename with _ but the warning didn't disappeared.

问题之一是,实际上这不是一个模块,它只是一个 python 脚本,但我仍然收到警告并且警告没有说明如何解决问题.

One of the problems is that in fact this is not a module, it's just a python script, still I get the warning and the warning says nothing about how to solve the issue.

文件名(不是必需的模块)的真正要求是什么?它们在哪里指定(PIP)?

What are the real requirements for filenames (not necessary modules) and where are they specified (PIP)?

如何在 PyDev 中解决这个问题?

How do I solve this problem in PyDev?

推荐答案

参见 http://docs.python.org/tutorial/modules.html 有关模块的信息.

See http://docs.python.org/tutorial/modules.html for information about modules.

要了解哪些字符有效,请查看语法import 语句.它告诉你 模块名称 需要是一个有效的标识符其中有以下规则:

To find out what characters are valid, have a look at the syntax of the import statement. It shows you that a module name needs to be a valid identifier which has the following rule:

identifier ::=  (letter|"_") (letter | digit | "_")*

这篇关于解决 PyDev 中 Python 模块警告的无效名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆