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

2024-06-13 06:06:44 发布

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

我正在使用一个用python编写的模拟软件MadGraph。MadGraph仅与Python2.7兼容。我的MadGraph与python3.7.4一起安装在/mnt/c/1文件夹中,正如我在/mnt/c/1目录中键入ls时所看到的那样。但是当我输入/mnt/c/1目录python——version时,我得到的是python2.7.15+。在/mnt/c/1MG5\u aMC\u v2\u 6\u 6目录中,我键入ls,但找不到python。当我在同一个目录中键入哪个python时,我得到/usr/bin/python。当我键入ls-bin时,我只得到MadGraph而没有python。你知道吗

我的问题是如何让Python2.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

我不明白为什么这个命令(显示模拟/生成的流程图)会出现操作系统错误。我可以很好地模拟这个过程,但我不能显示图表。最后我遇到了上面的错误,它被卡住了,我不得不按ctrl+c。我想知道是不是因为我安装了不同的python版本。我只是想理解这个用python编写的错误,以及如何修复它。 我非常感谢你的帮助。谢谢!你知道吗


Tags: inpylibusrlineexceptionepscall
1条回答
网友
1楼 · 发布于 2024-06-13 06:06:44

MisterMiyagi是正确的-回溯显示MadGraph使用的是Python2.7。你知道吗

但是,当您键入“command”时,MadGraph会尝试Popen()其他脚本或可执行文件。您将得到一个“errno 2”异常:无论脚本或可执行MadGraph试图打开什么,它都无法在当前的PATH中找到它。你知道吗

建议:

  1. 尝试strace确定Popen要查找的文件。

  2. 修改路径以包含此文件所在的目录。

请把你找到的寄回来。你知道吗

相关问题 更多 >