OSError:[Errno 2]没有python2.7 / subprocess.py这样的文件或目录

时间:2017-04-17 10:51:20

标签: python

我正在尝试使用将Latex转换为png的Python脚本。该库位于https://github.com/cptdeadbones/pytex2png

当我运行命令python examples.py时,我收到以下错误:

Traceback (most recent call last):
  File "./examples.py", line 14, in <module>
    main()
  File "./examples.py", line 11, in main
    pytex2png.convert("examples/"+file,"output/"+file+".png")
  File "/Users/kekearif/Desktop/pytex2png-master/pytex2png.py", line 44, in convert
    make_transparent_bg(output,display)
  File "/Users/kekearif/Desktop/pytex2png-master/pytex2png.py", line 31, in make_transparent_bg
    exe_command(command_line)
  File "/Users/kekearif/Desktop/pytex2png-master/pytex2png.py", line 11, in exe_command
    p = subprocess.Popen(args,stdout=subprocess.PIPE)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory'

这个错误是什么意思?参数的传递方式是错误的吗?

来自消息来源:

def exe_command(cmd, display=False):
    args = shlex.split(cmd)
    if(display):
        p = subprocess.Popen(args)
    else:
        p = subprocess.Popen(args,stdout=subprocess.PIPE)
    p.wait() 

上述功能有错吗?

1 个答案:

答案 0 :(得分:1)

我希望您已按照此处描述的用法进行操作:Usage创建Makefile。

你检查一下Disclaimers ??它说:

  

此代码在基于Linux的系统上进行了开发和测试。我没有   想法它是否适用于另一个系统。如果您已经测试过它   另一个系统,请告诉我。