本文介绍了CalledProcessError:返回非零退出状态1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试运行时:
def remove_stopwords(texts):
return [[word for word in simple_preprocess(str(doc)) if word not in stop_words] for doc in texts]
def make_bigrams(texts):
return [bigram_mod1[doc] for doc in texts]
# Remove Stop Words
data_words_nostops1 = remove_stopwords(data_words1)
# Form Bigrams
data_words_bigrams1 = make_bigrams(data_words_nostops1)
# Create Dictionary
id2word1 = corpora.Dictionary(data_words_bigrams1)
# Create Corpus
texts1 = data_words_bigrams1
# Term Document Frequency
corpus1 = [id2word1.doc2bow(text) for text in texts1]
mallet_path = 'T:Python/Mallet/mallet-2.0.8/bin/mallet'
ldamallet = gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus1, num_topics=15, id2word=id2word1)
我收到以下错误:
CalledProcessError: Command 'T:/Python/Mallet/mallet-2.0.8/bin/mallet import-file --preserve-case --keep-sequence --remove-stopwords --token-regex "\S+" --input C:\Users\E26E5~1.RIJ\AppData\Local\Temp\3\a66fc0_corpus.txt --output C:\Users\E26E5~1.RIJ\AppData\Local\Temp\3\a66fc0_corpus.mallet' returned non-zero exit status 1.
我可以在我的代码中专门做什么以使其起作用?
What can I do in my code specifically to make it work?
此外,关于此错误的问题已经被问过几次了.但是,每个答案似乎都是针对特定情况的,因此我看不到我现在可以在代码上进行哪些更改以使其起作用.有人可以详细说明这个问题的含义吗?
Furthermore, the question on this error has been asked a few times before. However, each answer seems so specific to a particular case, that I don't see what I can change on my code now so that it will work. Can someone elaborate on the meaning of this problem?
推荐答案
确保您拥有:
并将 env 放在正确的文件夹中,否则进行更新,例如:
And have your env in the correct folder, otherwise update it e.g.:
- 导入操作系统
- os.environ.update({'MALLET_PATH':r'Python/Mallet/mallet-2.0.8/bin'})
这篇关于CalledProcessError:返回非零退出状态1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!