gpt4 book ai didi

python - 使用anaconda在优胜美地安装gensim

转载 作者:太空宇宙 更新时间:2023-11-04 05:39:38 25 4
gpt4 key购买 nike

我已经在我的 MacBookPro (Yosemite 10.10.5) 上安装了 gensim,我正在使用 anconda。使用 pip install --upgrade gensim 安装正在工作,没有错误消息。当我尝试运行教程的代码时,调用序列化时出现错误: corpora.MmCorpus.serialize('/temp/deerwester.mm', corpus)

完整的错误信息:

File "/Users/sage/Desktop/gensim/test_gensim.py", line 39, in <module>
corpora.MmCorpus.serialize('/temp/deerwester.mm', corpus)
File "/System/Library/anaconda/lib/python2.7/site-packages/gensim-0.12.3-py2.7-macosx-10.5-x86_64.egg/gensim/corpora/indexedcorpus.py", line 94, in serialize
offsets = serializer.save_corpus(fname, corpus, id2word, metadata=metadata)
File "/System/Library/anaconda/lib/python2.7/site-packages/gensim-0.12.3-py2.7-macosx-10.5-x86_64.egg/gensim/corpora/mmcorpus.py", line 49, in save_corpus
return matutils.MmWriter.write_corpus(fname, corpus, num_terms=num_terms, index=True, progress_cnt=progress_cnt, metadata=metadata)
File "/System/Library/anaconda/lib/python2.7/site-packages/gensim-0.12.3-py2.7-macosx-10.5-x86_64.egg/gensim/matutils.py", line 486, in write_corpus
mw = MmWriter(fname)
File "/System/Library/anaconda/lib/python2.7/site-packages/gensim-0.12.3-py2.7-macosx-10.5-x86_64.egg/gensim/matutils.py", line 436, in __init__
self.fout = utils.smart_open(self.fname, 'wb+') # open for both reading and writing
File "/System/Library/anaconda/lib/python2.7/site-packages/smart_open/smart_open_lib.py", line 111, in smart_open
raise NotImplementedError('unknown file mode %s' % mode)
NotImplementedError: unknown file mode wb+

当我下载 tar 文件并执行 python setup.py test 时,错误 NotImplementedError: unknown file mode wb+也发生了。

我该如何解决这个问题?

最佳答案

看起来 gensimsmart_open 库不兼容。

我解决了同样的问题(在 linux 机器上)

pip uninstall smart_open

gensim 然后回退到直接使用文件系统,这对我来说很好。

关于python - 使用anaconda在优胜美地安装gensim,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34396300/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com