安装pyhanlp报错,之解决方案

 

背景:需要使用pyhanlp来解决提取关键词的工作(并且支持在win7上面使用)

环境要求很高啊

 

先说报错

C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-u617cfx3\jpype1\setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access
FeatureNotice)
building '_jpype' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

----------------------------------------
Command "d:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-u617cfx3\\jpype1\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-v70vznix\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-u617cfx3\jpype1\

 

先找问题在哪,很多网上的博客呀,都是爬虫过来的,尤其csdn是最不要脸, 看下图,JPype-...cp37的对吧

 

 

 

 

那我们再看GitHub上面写的,安装的是python3.8,而Jpype1只支持到最大python3.7,这不闹呢嘛

 

 

 

解决方案:

conda install -c conda-forge openjdk python=3.7 jpype1=0.7.0 -y
pip install pyhanlp

改成环境3.7就ok了呀

 

posted @ 2021-04-29 15:40  我当道士那儿些年  阅读(1106)  评论(0编辑  收藏  举报