简体   繁体   English

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

[英]/usr/lib/python2.7/subprocess.py OSError: [Errno 2] No such file or directory

I'm trying to use MEGAM with NLTK. 我正在尝试将MEGAM与NLTK一起使用。

This is my code: 这是我的代码:

import nltk
import os
megam_path = os.path.expanduser("~/nltk_data/megam_i686.opt")
nltk.config_megam(megam_path)
me_classifier = MaxentClassifier.train(train_feats,     algorithm='megam')
print me_classifier.show_most_informative_features(n=4)
print("accuracy of Maxent Classifier :  ",   accuracy(me_classifier, test_feats))

When running the file the output is: 运行文件时,输出为:

    [Found /home/ubuntu/nltk_data/megam_i686.opt:     /home/ubuntu/nltk_data/megam_i686.                       opt]
    Traceback (most recent call last):
      File "./classifying.py", line 494, in <module>
        me_classifier = MaxentClassifier.train(train_feats,   algorithm='megam')
      File "/usr/local/lib/python2.7/dist-    packages/nltk/classify/maxent.py", line 31                       9,     in train
        gaussian_prior_sigma, **cutoffs)
      File "/usr/local/lib/python2.7/dist-
packages/nltk/classify/maxent.py", line 15                          22, in train_maxent_classifier_with_megam
        stdout = call_megam(options)
      File "/usr/local/lib/python2.7/dist- packages/nltk/classify/megam.py", line 167                       ,     in call_megam
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
      File "/usr/lib/python2.7/subprocess.py", line 679, in    __init__
        errread, errwrite)
      File "/usr/lib/python2.7/subprocess.py", line 1249, in     _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory

But the file subprocess.py exists. 但是文件subprocess.py存在。

Any hints or suggestions? 有任何提示或建议吗?

It is not about subprocess.py file. 它与subprocess.py文件无关。 subprocess.Popen() starts a subprocess. subprocess.Popen()启动一个子进程。 Check that cmd is in $PATH . 检查cmd是否在$PATH You probably need to install some command-line utility to use MaxentClassifier . 您可能需要安装一些命令行实用程序才能使用MaxentClassifier

暂无
暂无

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

相关问题 OSError:[Errno 2] python2.7 / subprocess.py中没有这样的文件或目录 - OSError: [Errno 2] No such file or directory with python2.7/subprocess.py OSError:[Errno 2]没有这样的文件或目录:&#39;/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg&#39; - OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg' 错误:<class 'socket.error'> , [Errno 2] 没有这样的文件或目录:文件:/usr/lib/python2.7/socket.py 行:228</class> - error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 228 获取usr / bin / python2.7:那里没有这样的文件或目录 - Getting usr/bin/python2.7: No such file or directory when it's there __init__ OSError中的文件“ /usr/lib/python3.5/socket.py”,第134行,[Errno 24]打开的文件太多 - File “/usr/lib/python3.5/socket.py”, line 134, in __init__ OSError: [Errno 24] Too many open files ERR IOError:[Errno 21]是目录:&#39;/app/.heroku/python/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg&#39; - ERR IOError: [Errno 21] Is a directory: '/app/.heroku/python/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg' ValueError:无法将字符串从/usr/lib/python2.7/string.py转换为float - ValueError: could not convert string to float from /usr/lib/python2.7/string.py OSError: [Errno 2] 在 Django 中使用 python 子进程时没有这样的文件或目录 - OSError: [Errno 2] No such file or directory while using python subprocess in Django Python:OSError:[Errno 2] subprocess.Popen上没有这样的文件或目录 - Python: OSError: [Errno 2] No such file or directory on subprocess.Popen Python:subprocess.Popen返回OSError:[Errno 2]没有这样的文件或目录 - Python: subprocess.Popen returns OSError: [Errno 2] No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM