简体   繁体   English

已安装 Python 2.7 和 Python 3.7。 如何将 MadGraph 与 Python 2.7 一起使用?

[英]Python 2.7 and Python 3.7 installed. How to use MadGraph with Python 2.7?

I am working with a simulation software MadGraph that is written in python.我正在使用用 python 编写的模拟软件 MadGraph。 MadGraph is only compatible with python 2.7. MadGraph 仅与 python 2.7 兼容。 My MadGraph is installed in /mnt/c/1 folder with Python 3.7.4 as I can see when I type ls in the /mnt/c/1 directory.我的 MadGraph 安装在带有 Python 3.7.4 的 /mnt/c/1 文件夹中,正如我在 /mnt/c/1 目录中键入 ls 时看到的那样。 But when I type in the /mnt/c/1 directory python --version I get python 2.7.15+.但是当我输入 /mnt/c/1 目录 python --version 我得到 python 2.7.15+。 In /mnt/c/1MG5_aMC_v2_6_6 directory I type ls and I can't find python.在 /mnt/c/1MG5_aMC_v2_6_6 目录中,我键入 ls,但找不到 python。 When I type which python in the same directory I get /usr/bin/python.当我在同一目录中键入 which python 时,我得到 /usr/bin/python。 When I type ls bin I just get MadGraph and no python.当我输入 ls bin 时,我只得到 MadGraph 而没有 python。

My question is how can I have python 2.7 working with MadGraph.我的问题是如何让 python 2.7 与 MadGraph 一起使用。 I can work with MadGraph up to a certain point.我可以在一定程度上使用 MadGraph。 When I want to type in a certain command in MadGraph I get this error:当我想在 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

I don't understand why I get this OS error for this certain command (of displaying the diagrams of the process that was simulated/generated).我不明白为什么我会为这个特定命令(显示模拟/生成的进程图)收到此操作系统错误。 I can simulate the process fine but I can't display the diagrams.我可以很好地模拟这个过程,但我无法显示图表。 I end up with the error above and it gets stuck and I have to ctrl+c.我最终遇到了上面的错误,它卡住了,我必须按 ctrl+c。 I am wondering if it is because of the different python versions I have installed.我想知道是否是因为我安装了不同的 python 版本。 I am just trying to understand this error written in python and how I can fix it.我只是想了解这个用 python 编写的错误以及如何修复它。 I would really appreciate some help.我真的很感激一些帮助。 thanks!谢谢!

MisterMiyagi is correct - the traceback shows that MadGraph is using Python 2.7. Miyagi 是正确的 - 回溯显示 MadGraph 正在使用 Python 2.7。

However, when you type a "command", MadGraph tries to Popen() some other script or executable.但是,当您键入“命令”时,MadGraph 会尝试 Popen ()一些其他脚本或可执行文件。 You're getting an "errno 2" exception: whatever script or executable MadGraph is trying to open, it can't find it in your current PATH .你得到一个“errno 2”异常:无论 MadGraph 试图打开什么脚本或可执行文件,它都无法在你当前的PATH中找到它。

SUGGESTIONS:建议:

  1. Try strace to determine exactly what file Popen is trying to find.尝试strace以确定 Popen 试图查找的确切文件。

  2. Modify your PATH to include the directory this file is located in.修改您的 PATH 以包含此文件所在的目录。

Please post back what you find.请发回您找到的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Python 2.7解码更新为Python 3.7 - how to update Python 2.7 decode to Python 3.7 我安装了 Python 3 x64、Python 2.7 x64 和 Python 2.7 x32。 如何使用 py 启动器切换到 Python 2.7 的 32 位版本? - I have Python 3 x64, Python 2.7 x64, and Python 2.7 x32 installed. How can I use py launcher to switch to the 32 bit version of Python 2.7? Python 2.7 安装在我的 mac 上的 python 3.7 文件夹中吗? - Python 2.7 installed in python 3.7 folder on my mac? 将Anaconda安装到具有Python2.7和3.7的macOS上。 熊猫只进口到2.7; 如何导入3.7? - Installed Anaconda to macOS that has Python2.7 and 3.7. Pandas only importing to 2.7; how can I import to 3.7? Shell选择的是Python 2.7,而不是3.7 - Shell is selecting Python 2.7, but not 3.7 Python 3.7 与 2.7,分配 - Python 3.7 vs 2.7, assignment Python 2.7 不会加载我安装的任何模块。 只会加载 Python 2.7 附带的原生模块 - Python 2.7 won't load any modules I installed. Will only load native modules that come with Python 2.7 Flask是为Python 2.7而非Python 3安装的 - Flask is installed for Python 2.7 and not for Python 3 将Python 2.7 ZIP破解器“现代化”到Python 3.7 - 'Modernizing' a Python 2.7 ZIP Cracker to Python 3.7 我如何将python2.7和3.7都安装在高山docker映像中 - How do I get python2.7 and 3.7 both installed in an alpine docker image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM