已安装Python 2.7和Python 3.7。如何在Python2.7中使用MadGraph?

已安装Python 2.7和Python 3.7。如何在Python2.7中使用MadGraph?,python,python-2.7,ubuntu,operating-system,Python,Python 2.7,Ubuntu,Operating System,我正在使用一个用python编写的模拟软件MadGraph。MadGraph仅与python 2.7兼容。我的MadGraph与Python3.7.4一起安装在/mnt/c/1文件夹中,我在/mnt/c/1目录中键入ls时可以看到这一点。但是当我输入/mnt/c/1目录python--version时,我得到了python2.7.15+。在/mnt/c/1MG5_aMC_v2_6_6目录中,我键入ls,但找不到python。当我在同一目录中键入哪个python时,我得到/usr/bin/pyth

我正在使用一个用python编写的模拟软件MadGraph。MadGraph仅与python 2.7兼容。我的MadGraph与Python3.7.4一起安装在/mnt/c/1文件夹中,我在/mnt/c/1目录中键入ls时可以看到这一点。但是当我输入/mnt/c/1目录python--version时,我得到了python2.7.15+。在/mnt/c/1MG5_aMC_v2_6_6目录中,我键入ls,但找不到python。当我在同一目录中键入哪个python时,我得到/usr/bin/python。当我键入ls-bin时,我只得到MadGraph,而没有python

我的问题是如何让python 2.7与MadGraph一起工作。我可以在一定程度上使用MadGraph。当我想在MadGraph中键入某个命令时,会出现以下错误:

Total: 4 processes with 4 diagrams
MG5_aMC>display diagrams
Drawing Process: u u~ > z > mu+ mu- WEIGHTED<=4 @1
Wrote file /tmp/diagrams_1_uux_z_mupmum.eps
open /tmp/diagrams_1_uux_z_mupmum.eps
Drawing Process: c c~ > z > mu+ mu- WEIGHTED<=4 @1
Wrote file /tmp/diagrams_1_ccx_z_mupmum.eps
open /tmp/diagrams_1_ccx_z_mupmum.eps
Drawing Process: d d~ > z > mu+ mu- WEIGHTED<=4 @1
Unhandled exception in thread started by <function call at 
0x7fbbb476bc08>Wrote file /tmp/diagrams_1_ddx_z_mupmum.eps

Traceback (most recent call last):
open /tmp/diagrams_1_ddx_z_mupmum.eps
File "/usr/lib/python2.7/subprocess.py", line 172, in call
Drawing Process: s s~ > z > mu+ mu- WEIGHTED<=4 @1
Unhandled exception in thread started by <function call at 0x7fbbb476bc08>
Traceback (most recent call last):
File "/usr/lib/python2.7/subprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
Wrote file /tmp/diagrams_1_ssx_z_mupmum.eps
open /tmp/diagrams_1_ssx_z_mupmum.eps
raise child_exception
time to draw 0.063835144043
raise child_exception
OSErrorOSError: [Errno 2] No such file or directory: [Errno 2] No such 
file or directory
MG5_aMC>
Unhandled exception in thread started by <function call at 0x7fbbb476bc08>
Traceback (most recent call last):
File "/usr/lib/python2.7/subprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Unhandled exception in thread started by <function call at 0x7fbbb476bc08>
Traceback (most recent call last):
File "/usr/lib/python2.7/subprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
总计:4个流程,4个图表
MG5_aMC>显示图表
绘图过程:u u~>z>mu+mu加权z>mu+mu加权z>mu+mu加权z>mu+mu加权z>mu+mu加权
由启动的线程中存在未处理的异常
回溯(最近一次呼叫最后一次):
文件“/usr/lib/python2.7/subprocess.py”,第172行,在调用中
返回Popen(*popenargs,**kwargs)。等待()
文件“/usr/lib/python2.7/subprocess.py”,第394行,在__
错误读取,错误写入)
文件“/usr/lib/python2.7/subprocess.py”,第1047行,在执行子进程中
引发子对象异常
OSError:[Errno 2]没有这样的文件或目录
由启动的线程中存在未处理的异常
回溯(最近一次呼叫最后一次):
文件“/usr/lib/python2.7/subprocess.py”,第172行,在调用中
返回Popen(*popenargs,**kwargs)。等待()
文件“/usr/lib/python2.7/subprocess.py”,第394行,在__
错误读取,错误写入)
文件“/usr/lib/python2.7/subprocess.py”,第1047行,在执行子进程中
引发子对象异常
OSError:[Errno 2]没有这样的文件或目录
我不明白为什么我会因为这个命令(显示模拟/生成的流程图)而出现这个操作系统错误。我可以很好地模拟这个过程,但我不能显示图表。我最后遇到了上面的错误,它被卡住了,我必须按ctrl+c组合键。我想知道这是否是因为我安装了不同的python版本。我只是想了解这个用python编写的错误,以及如何修复它。
我真的很感谢你的帮助。谢谢

MisterMiyagi是正确的-回溯显示MadGraph正在使用Python 2.7

但是,当您键入“命令”时,MadGraph会尝试使用其他脚本或可执行文件。您将得到一个“errno 2”异常:无论MadGraph试图打开什么脚本或可执行文件,它都无法在当前文件中找到它

建议:

  • 尝试准确确定Popen要查找的文件

  • 修改路径以包含此文件所在的目录


  • 请将您的发现发回。

    为什么您认为这与Python2和Python3有关?您的回溯显示使用了正确版本的python(2.7)。这似乎是MadGraph的多线程绘图中的一个错误。您联系过开发人员吗?MisterMiyagi是正确的-回溯显示MadGraph正在使用Python 2.7。但是,当您键入“命令”时,MadGraph会尝试使用其他脚本或可执行文件。您将得到一个“errno 2”异常:无论MadGraph试图打开什么脚本或可执行文件,它都无法在当前文件中找到它。建议:试试看。看起来这对您没有帮助,但是一些关于管理Python2.7和Python3的未经请求的建议:使用虚拟环境。我建议你要么去,要么去。从经验来看:在没有虚拟环境的情况下管理不同的Python安装会让你感到难过。