安装gensim扩展包需要先安装numpy和scipy
先下载这三个文件的安装包。
注意安装包版本问题,可以进入python查看:
这里注意图中划线的两个地方即可,win代表的是是windows系统
Win+R cmd
切换到安装包所在路径:
pip install numpy +安装包名称:
结果报错,提示的意思是pip版本过低
Python -m pip install --upgrade pip
更新pip版本
依次安装 numpy、scipy、gensim
pip install numpy numpy-1.22.3-cp310-cp310-win_amd64.whl
pip install scipy scipy-1.7.3-cp310-cp310-win_amd64.whl
pip install gensim gensim-4.1.1-cp310-cp310-win_amd64.whl
然后运行python
Import numpy
Import scipy 都成功了
结果import gensim却报错:import gensim ImportError: DLL load failed while importing qhull: 找不到指定的模块。
解决方式:
切换到安装包路径,依次卸载刚才装过的三个包
Pip uninstall gensim gensim-4.1.1-cp310-cp310-win_amd64.whl
(是否卸载y/n):y
Pip uninstall scipy scipy-1.7.3-cp310-cp310-win_amd64.whl
(是否卸载y/n):y
Pip uninstall numpy numpy-1.22.3-cp310-cp310-win_amd64.whl
(是否卸载y/n):y
去网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
使劲向下拉找到对应版本的安装包:
下载:numpy-1.22.2+mkl-cp310-cp310-win_amd64.whl
然后依次安装 numpy 、scipy、gensim 顺序不可以错
pip install numpy numpy-1.22.2+mkl-cp310-cp310-win_amd64.whl
pip install scipy scipy-1.7.3-cp310-cp310-win_amd64.whl
pip install gensim gensim-4.1.1-cp310-cp310-win_amd64.whl
运行python
导入gensim成功:
更多推荐
python中安装gensim包
发布评论