2012-06-25 27 views
-3

我想执行下面的命令,但cygwin给出错误。 请帮帮我。Cygwin使用python提供错误

Python makeReadingsFile.py eichstaett.net.xml test.readings.xml 

Traceback (most recent call last): 
    File "makeReadingsFile.py", line 75, in <module> 
    import argparse 
ImportError: No module named argparse 
+3

这就是说,在你所在的目录下没有makeReadingsFile.py这样的文件 – matcheek

+0

我在这里存在这个文件的路径。尽管当我测试命令中的完整地址时,会发生以下错误:Python makeReadingsFile.py eichstaett.net.xml test.readings.xml 回溯(最近调用最后一次): 文件“makeReadingsFile.py”,第75行, import argparse ImportError:没有名为argparse的模块 –

+0

'ls | grep .py'? –

回答

1

如前所述,错误信息

$ Python makeReadingsFile.py eichstaett.net.xml test.readings.xml 
Python: can't open file 'makeReadingsFile.py': [Errno 2] No such file or directory 

发生,因为有你在哪里,告诉它寻找一个没有这样的文件。你的第二个命令看起来我的眼睛就像第一个命令:

Python makeReadingsFile.py eichstaett.net.xml test.readings.xml 
Traceback (most recent call last): 
    File "makeReadingsFile.py", line 75, in <module> 
    import argparse 
ImportError: No module named argparse 

,你说这是使用完整的地址路径,但由于给定的路径是一样的我想你一定是说像“当你切换到正确的目录“。无论如何,这里的错误信息可能是由于您使用的是Python 2.6或之前的版本:argparse模块仅在Python 2.7中引入。

+0

非常感谢。这是解决问题的最佳选择。我转向它的目录,但在我眼中这两个意思是一个。如何找到并安装python2.7? –

+0

@hossein torki:他们不一样。通过'给出完整路径',我们通常意味着像'python/home/someone/programs/someprogram.py'。你可以通过自己编译或者下载Windows安装程序来安装2.7,然后将它的目录添加到cygwin环境变量中。谷歌有很多解释。 – DSM

+0

好的,谢谢,但他们两个是相同的意思。不重要的,谢谢 –