【发布时间】:2020-02-03 02:48:13
【问题描述】:
我正在使用一个用 python 编写的模拟软件 MadGraph。 MadGraph 仅与 python 2.7 兼容。我的 MadGraph 使用 Python 3.7.4 安装在 /mnt/c/1 文件夹中,正如我在 /mnt/c/1 目录中键入 ls 时看到的那样。但是当我输入 /mnt/c/1 目录 python --version 我得到 python 2.7.15+。在 /mnt/c/1MG5_aMC_v2_6_6 目录中,我键入 ls 但找不到 python。当我在同一目录中键入 which 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
我不明白为什么这个特定命令(显示模拟/生成的进程图)会出现此操作系统错误。我可以很好地模拟这个过程,但我无法显示图表。我最终遇到了上面的错误,它卡住了,我必须按 ctrl+c。我想知道是不是因为我安装了不同的python版本。我只是想了解这个用 python 编写的错误以及如何修复它。 我真的很感激一些帮助。谢谢!
【问题讨论】:
-
为什么你认为这与 python 2 vs 3 有关?您的回溯表明使用了正确版本的 python (2.7)。这似乎是 MadGraph 的多线程绘图中的一个错误。你联系过开发者吗?
-
看起来它在这里对你没有帮助,但是一些关于管理 Python 2.7 和 Python 3 的不请自来的建议:使用虚拟环境。我推荐
virtualenv或conda。经验之谈:在没有虚拟环境的情况下管理不同的 Python 安装会让你感到难过。
标签: python python-2.7 ubuntu operating-system