Python脚本正在打开python2.7interp

2024-04-26 04:56:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我最近在kubuntu12.04上安装了几个Python包(iPythonmatplotlibnumpyipython-notebookipython-qtconsolepython-scipy)。现在,当我尝试从命令行(./script.py)运行python脚本时,我被抛出到python解释器中。在

示例:

user@machine:~/$ ./script.py 

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> 

为什么会这样?在

我能做些什么来阻止这一切?在

除了删除iPython之外还有其他选择吗?在

编辑: 我应该提到这个脚本是一个python模块。我不知道这是否与此有关。我可以运行一个简单的hello world脚本。在

@亚当·米哈尔辛: #!/usr/bin/python

编辑2: 看来这和iPython没有关系。我删除了iPython,但我仍然遇到这个问题。这是文件的内容。(我的大多数Python文件都是这样)

^{pr2}$

编辑3: 虚惊一场!在

这太尴尬了。结果我知道我的help()函数会遇到名称空间问题。我把它改成了helpMenu(),但忘了更改它的调用位置。在

我很抱歉浪费时间。:(


Tags: orofthetopy脚本modules编辑