如何解决macs10.15.7 和 3.9.0 上的 gensim 安装错误
我尝试通过 pip install gensim
安装 gensim,但在 python 3.9
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:649:25: error: no template named 'numeric_limits'
return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
^
fatal error: too many errors emitted,stopping now [-ferror-limit=]
220 warnings and 20 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: ~/.pyenv/versions/3.9.0/envs/jupyter/bin/python3.9 -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/private/var/folders/pg/1drqvjn54tbczc1pl5qd8qwh0000gp/T/pip-install-ndvn1a9y/gensim_2b2eae30f7e140c0af90d98d9e598905/setup.py'"'"'; __file__='"'"'/private/var/folders/pg/1drqvjn54tbczc1pl5qd8qwh0000gp/T/pip-install-ndvn1a9y/gensim_2b2eae30f7e140c0af90d98d9e598905/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' install --record /private/var/folders/pg/1drqvjn54tbczc1pl5qd8qwh0000gp/T/pip-record-_xbpvhdn/install-record.txt --single-version-externally-managed --compile --install-headers ~/.pyenv/versions/3.9.0/envs/jupyter/include/site/python3.9/gensim
我用谷歌搜索,找不到任何解决方案。有人可以分享一些指针
解决方法
根据 main gensim pages 的说法,它可能尚未为 Python 3.9 做好准备。
“Gensim 正在 Python 3.5、3.6、3.7 和 3.8 下持续测试。在 gensim 4.0.0 中不再支持 Python 2.7 – 如果您必须使用 Python 2.7,请安装 gensim 3.8.3”
您可以将 Python 版本“降级”到 3.5/3.6/3.7 或 3.8,它应该可以工作。