手动安装pyhanlp【遇坑报错全程合集和解说】


手动安装pyhanlp


之前无论用什么版本的python,使用conda或者pip下载安装pyhanlp老出错。决定手动进行安装。
步骤一:
安装pyhanlp之前看了是得先安装jpype,方法:

方法一:
执行pip install jpype1
手动安装pyhanlp【遇坑报错全程合集和解说】_第1张图片
测试是否安装jpype成功:
在python命令行中输入:

>>> import jpype
>>> jvmPath=jpype.getDefaultJVMPath()
>>> print(jvmPath)
D:\java\JAVA-base\JDK-1.8.202\jre\bin\server\jvm.dll

能打印出则安装成功。

方法二:(如果方法一不行就用这个)
是要寻找对应Python版本的jype的whl。
使用如下命令看匹配的是什么版本

python
import pip._internal
print(pip._internal.pep425tags.get_supported())

不出意外要出意外,显示Traceback (most recent call last):

1.接着找的解决方法

>>> import pip._internal.pep425tags
>>> print(pip._internal.pep425tags.get_supported())

①报错信息:

>>> import pip._internal.pep425tags
Traceback (most recent call last):
  File "", line 1, in <module>
ModuleNotFoundError: No module named 'pip._internal.pep425tags'

1.报错信息①解决方法

python get-pip.py --force-reinstall

报错信息:

python: can't open file 'get-pip.py': [Errno 2] No such file or directory

2.报错信息①解决方法:

python get-pip.py

报错信息

python: can't open file 'get-pip.py': [Errno 2] No such file or directory

3.报错信息①解决方法

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

成功。
执行

>>>import pip._internal.pep425tags
>>>print(pip._internal.pep425tags.get_supported())

去https://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype下载对应版本已经编译好的whl文件。直接用编译好的文件来安装。
下载完成后cd到文件路径下,pip install 【下载的文件名】
即可安装成功,如果不成功就先pip install wheel再安装即可。

步骤二:
不死心再次执行pip install pyhanlp

pip install pyhanlp
Collecting pyhanlp
  Using cached pyhanlp-0.1.84.tar.gz (136 kB)
  Preparing metadata (setup.py) ... done
Collecting jpype1==0.7.0
  Using cached JPype1-0.7.0.tar.gz (470 kB)
  Preparing metadata (setup.py) ... done
Collecting hanlp-downloader
  Using cached hanlp_downloader-0.0.25.tar.gz (13 kB)
  Preparing metadata (setup.py) ... done
Collecting requests
  Downloading requests-2.28.0-py3-none-any.whl (62 kB)
     ---------------------------------------- 62.8/62.8 kB 105.2 kB/s eta 0:00:00
Collecting charset-normalizer~=2.0.0
  Using cached charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2022.6.15-py3-none-any.whl (160 kB)
     ---------------------------------------- 160.2/160.2 kB 16.9 kB/s eta 0:00:00
Using legacy 'setup.py install' for pyhanlp, since package 'wheel' is not installed.
Using legacy 'setup.py install' for jpype1, since package 'wheel' is not installed.
Using legacy 'setup.py install' for hanlp-downloader, since package 'wheel' is not installed.
Installing collected packages: jpype1, urllib3, idna, charset-normalizer, certifi, requests, hanlp-downloader, pyhanlp
  Attempting uninstall: jpype1
    Found existing installation: JPype1 1.4.0
    Uninstalling JPype1-1.4.0:
      Successfully uninstalled JPype1-1.4.0
  Running setup.py install for jpype1 ... error
  error: subprocess-exited-with-error

  × Running setup.py install for jpype1 did not run successfully.
  │ exit code: 1
  ╰─> [53 lines of output]
      Found native jni.h at D:\java\JAVA-base\JDK-1.8.202\include
      d:\java\python\python382\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'use_scm_version'
        warnings.warn(msg)
      running install
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.8
      creating build\lib.win-amd64-3.8\jpype
      copying jpype\beans.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\imports.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\nio.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\reflect.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\types.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_classpath.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_core.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_cygwin.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_darwin.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_gui.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jarray.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jboxed.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jclass.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jcollection.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jcomparable.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jcustomizer.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jexception.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jinit.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jio.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jobject.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jpackage.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jproxy.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jstring.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jtypes.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_jvmfinder.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_linux.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_pykeywords.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\_windows.py -> build\lib.win-amd64-3.8\jpype
      copying jpype\__init__.py -> build\lib.win-amd64-3.8\jpype
      running build_ext
      running build_java
      Using Jar cache
      creating build\lib
      creating build\lib\org
      creating build\lib\org\jpype
      creating build\lib\org\jpype\classloader
      copying native\jars\org\jpype\classloader\JPypeClassLoader.class -> build\lib\org\jpype\classloader
      copying native\jars\org.jpype.jar -> build\lib
      running build_thunk
      Building thunks
        including thunk build\lib\org\jpype\classloader\JPypeClassLoader.class
        including thunk build\lib\org.jpype.jar
      building '_jpype' extension
      error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  WARNING: No metadata found in d:\java\python\python382\lib\site-packages
  Rolling back uninstall of jpype1
  Moving to d:\java\python\python382\lib\site-packages\_jpype.cp38-win_amd64.pyd
   from C:\Users\devil\AppData\Local\Temp\pip-uninstall-p8gq_bg9\_jpype.cp38-win_amd64.pyd
  Moving to d:\java\python\python382\lib\site-packages\jpype1-1.4.0.dist-info\
   from D:\java\Python\python382\Lib\site-packages\~pype1-1.4.0.dist-info
  Moving to d:\java\python\python382\lib\site-packages\jpype\
   from D:\java\Python\python382\Lib\site-packages\~pype
  Moving to d:\java\python\python382\lib\site-packages\org.jpype.jar
   from C:\Users\devil\AppData\Local\Temp\pip-uninstall-p8gq_bg9\org.jpype.jar
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> jpype1

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

方法:
进入官网下载zip ,然后解压官网
解压之后,在解压后的安装目录D:\java\Python\python382\Lib\site-packages\HanLP-doc-zh(这是安装目录)执行:

python setup.py install

显示

Downloading https://files.pythonhosted.org/packages/8e/57/3066077aa16a852f3da0239796fa487baba0104ca2eb26f9ca4f56a7a86d/torch-1.7.0-cp38-cp38m-win_amd64.whl#sha256=83538fd7920bd02c8b6403ebe4ecee3e0641fe7bb6a18efc4585d2e1375ad1de
error: The read operation timed out

download的网址 你复制点进去就可以收获一个下载的东西,复制下载的包的名称,国外网址下载慢,去国内镜像网站https://pypi.doubanio.com/simple/
找到同名称的包下载
手动安装pyhanlp【遇坑报错全程合集和解说】_第2张图片
找到该文件的下载目录,执行pip install 所在目录
在这里插入图片描述
换了另两种方式,依然失败
在这里插入图片描述
执行pip install pyhanlp,出错了。但是python是3.8.2的,咱也不知道出啥事了。。。。。。。

pip install pyhanlp
Defaulting to user installation because normal site-packages is not writeable
Collecting pyhanlp
  Using cached pyhanlp-0.1.84.tar.gz (136 kB)
    ERROR: Command errored out with exit status 1:
     command: 'D:\java\java-EE\anaconda3\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-00nlm7sc\\pyhanlp_4207eb5f28974a92bf880c28f77e3645\\setup.py'"'"'; __file__='"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-00nlm7sc\\pyhanlp_4207eb5f28974a92bf880c28f77e3645\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\devil\AppData\Local\Temp\pip-pip-egg-info-8tzxypiu'
         cwd: C:\Users\devil\AppData\Local\Temp\pip-install-00nlm7sc\pyhanlp_4207eb5f28974a92bf880c28f77e3645\
    Complete output (10 lines):

    ----------------------------------------

    抱歉,暂不支持 Python 3.9 及以上版本。请执行如下命令:

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

    详细安装教程:https://bbs.hankcs.com/t/topic/13#install-1

    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/d2/fa/19ca69e0b94bbd9fed93272e5952d2308c13688647fac779a52729fa801f/pyhanlp-0.1.84.tar.gz#sha256=1047b2b6515c9844648c48f45b1f1cdb9a413067bea55587717a52c2944ad616 (from https://pypi.org/simple/pyhanlp/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached pyhanlp-0.1.83.tar.gz (136 kB)
    ERROR: Command errored out with exit status 1:
     command: 'D:\java\java-EE\anaconda3\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-00nlm7sc\\pyhanlp_da719efa6be34dc183fd6cdda5c37807\\setup.py'"'"'; __file__='"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-00nlm7sc\\pyhanlp_da719efa6be34dc183fd6cdda5c37807\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\devil\AppData\Local\Temp\pip-pip-egg-info-_7n5gjya'
         cwd: C:\Users\devil\AppData\Local\Temp\pip-install-00nlm7sc\pyhanlp_da719efa6be34dc183fd6cdda5c37807\
    Complete output (10 lines):

    ----------------------------------------

    抱歉,暂不支持 Python 3.9 及以上版本。请执行如下命令:

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

    详细安装教程:https://bbs.hankcs.com/t/topic/13#install-1

    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/72/ec/d9097f82046739ee8a2aa227c5d56203bffefaf8e460d9d5411c751c0738/pyhanlp-0.1.83.tar.gz#sha256=2651a8875aa9b92353a59017cc0368f3bdbd6dada8b100504ab80917fb5db410 (from https://pypi.org/simple/pyhanlp/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pyhanlp (from versions: 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.1.16, 0.1.17, 0.1.18, 0.1.19, 0.1.20, 0.1.21, 0.1.22, 0.1.23, 0.1.24, 0.1.25, 0.1.26, 0.1.27, 0.1.28, 0.1.29, 0.1.30, 0.1.31, 0.1.32, 0.1.33, 0.1.34, 0.1.35, 0.1.36, 0.1.37, 0.1.38, 0.1.39, 0.1.40, 0.1.41, 0.1.42, 0.1.43, 0.1.44, 0.1.45, 0.1.46, 0.1.47, 0.1.48, 0.1.49, 0.1.50, 0.1.51, 0.1.52, 0.1.53, 0.1.54, 0.1.55, 0.1.56, 0.1.57, 0.1.58, 0.1.59, 0.1.60, 0.1.61, 0.1.62, 0.1.63, 0.1.64, 0.1.65, 0.1.66, 0.1.80, 0.1.81, 0.1.82, 0.1.83, 0.1.84)
ERROR: No matching distribution found for pyhanlp

(base) C:\Users\devil>pip install pyhanlp --user
Collecting pyhanlp
  Using cached pyhanlp-0.1.84.tar.gz (136 kB)
    ERROR: Command errored out with exit status 1:
     command: 'D:\java\java-EE\anaconda3\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-9tdcnwcf\\pyhanlp_03a5c468a8f942dbb28d4b0715dc6143\\setup.py'"'"'; __file__='"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-9tdcnwcf\\pyhanlp_03a5c468a8f942dbb28d4b0715dc6143\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\devil\AppData\Local\Temp\pip-pip-egg-info-emzmt11j'
         cwd: C:\Users\devil\AppData\Local\Temp\pip-install-9tdcnwcf\pyhanlp_03a5c468a8f942dbb28d4b0715dc6143\
    Complete output (10 lines):

    ----------------------------------------

    抱歉,暂不支持 Python 3.9 及以上版本。请执行如下命令:

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

    详细安装教程:https://bbs.hankcs.com/t/topic/13#install-1

    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/d2/fa/19ca69e0b94bbd9fed93272e5952d2308c13688647fac779a52729fa801f/pyhanlp-0.1.84.tar.gz#sha256=1047b2b6515c9844648c48f45b1f1cdb9a413067bea55587717a52c2944ad616 (from https://pypi.org/simple/pyhanlp/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached pyhanlp-0.1.83.tar.gz (136 kB)
    ERROR: Command errored out with exit status 1:
     command: 'D:\java\java-EE\anaconda3\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-9tdcnwcf\\pyhanlp_2e2ec644ecfa487d86fc5e7af8850955\\setup.py'"'"'; __file__='"'"'C:\\Users\\devil\\AppData\\Local\\Temp\\pip-install-9tdcnwcf\\pyhanlp_2e2ec644ecfa487d86fc5e7af8850955\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\devil\AppData\Local\Temp\pip-pip-egg-info-66xbjw91'
         cwd: C:\Users\devil\AppData\Local\Temp\pip-install-9tdcnwcf\pyhanlp_2e2ec644ecfa487d86fc5e7af8850955\
    Complete output (10 lines):

    ----------------------------------------

    抱歉,暂不支持 Python 3.9 及以上版本。请执行如下命令:

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

    详细安装教程:https://bbs.hankcs.com/t/topic/13#install-1

    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/72/ec/d9097f82046739ee8a2aa227c5d56203bffefaf8e460d9d5411c751c0738/pyhanlp-0.1.83.tar.gz#sha256=2651a8875aa9b92353a59017cc0368f3bdbd6dada8b100504ab80917fb5db410 (from https://pypi.org/simple/pyhanlp/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pyhanlp (from versions: 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.1.16, 0.1.17, 0.1.18, 0.1.19, 0.1.20, 0.1.21, 0.1.22, 0.1.23, 0.1.24, 0.1.25, 0.1.26, 0.1.27, 0.1.28, 0.1.29, 0.1.30, 0.1.31, 0.1.32, 0.1.33, 0.1.34, 0.1.35, 0.1.36, 0.1.37, 0.1.38, 0.1.39, 0.1.40, 0.1.41, 0.1.42, 0.1.43, 0.1.44, 0.1.45, 0.1.46, 0.1.47, 0.1.48, 0.1.49, 0.1.50, 0.1.51, 0.1.52, 0.1.53, 0.1.54, 0.1.55, 0.1.56, 0.1.57, 0.1.58, 0.1.59, 0.1.60, 0.1.61, 0.1.62, 0.1.63, 0.1.64, 0.1.65, 0.1.66, 0.1.80, 0.1.81, 0.1.82, 0.1.83, 0.1.84)
ERROR: No matching distribution found for pyhanlp

总结刚刚的问题,就是torch安装失败了呗,运行pyhanlp只差一个torch了(应该?),咱就是换一个数据源下载安装torch喽。
我的pyhanlp需要的是1.7.0版本的。我们换成清华源的执行:

pip install torch==1.7.0 -f https://download.pytorch.org/whl/torch_stable.html

出现了报错

Using legacy 'setup.py install' for future, since package 'wheel' is not installed.

进入Scripts执行pip install wheel即可。
手动安装pyhanlp【遇坑报错全程合集和解说】_第3张图片
报错又

ModuleNotFoundError: No module named ‘setuptools_rust‘

执行pip3 install -U pip setuptools 手动安装pyhanlp【遇坑报错全程合集和解说】_第4张图片
运行pip install pyhanlp报错

Downloading https://files.pythonhosted.org/packages/bb/23/76fe2c3976185325021c8ff6ae72051bb4302e3f0d89d1986cc877505b4c/transformers-4.20.1-py3-none-any.whl#sha256=d284eaf60b10fee45b24688423b5f7ba2d194f8c2dadf8df76cd58c1a9d08b52
error: The read operation timed out

老规矩点进去下载,然后pip install 这个文件的地址pip install D:\java\Python\packages\pythonhosted\transformers-4.20.1-py3-none-any.whl

报错ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. hanlp 2.1.0b34 requires pynvml, which is not installed. hanlp 2.1.0b34 requires termcolor, which is not installed. hanlp 2.1.0b34 requires toposort==1.5, which is not installed.
缺啥,就安装啥。

pip install pynvml -i https://pypi.mirrors.ustc.edu.cn/simple

类似这样的,依次安装。执行sudo -H pip3 install xxx(不针对win10 避雷)好像也是可以的,我用的第一种。
再次执行刚刚的pip install D:\java\Python\packages\pythonhosted\transformers-4.20.1-py3-none-any.whl
显示已经installed即可。
通过刚刚的报错,我们可以换个下载源关于python setup.py install。
换下载源
在你的setup.py同目录放置setup.cfg:

[easy_install]

index_url = https://pypi.tuna.tsinghua.edu.cn/simple

手动安装pyhanlp【遇坑报错全程合集和解说】_第5张图片

再次执行python setup.py install
成功了。


最终解决方法:


两天搞了一堆解决方法,都失败了,成功方法如下:去

官网下载pyhanlp的zip(进行这一步的前提是pype1啥的都装好了,参考我上述的一些东西)
解压zip到D:\java\Python\python382\Lib\site-packages //(你自己python安装目录的那个文件)
我用的pycharm,cd 到D:\java\Python\python382\Lib\site-packages\pyhanlp-0.1.84-py3.8.egg\pyhanlp 也就是pyhanlp安装的在的目录
执行python setup.py install
我这里有点小报错,下载data-for-1.7.5.zip和hanlp-1.8.3.-release.zip,解压后分别获得data文件夹和hanlp.properties、hanlp-1.8.3.jar文件. 下载地址
下载最新版就可以了。
进入pyhanlp的static目录保证如下结构:
手动安装pyhanlp【遇坑报错全程合集和解说】_第6张图片
修改hanlp.properties的root:
在这里插入图片描述

在命令行运行:hanlp -v
手动安装pyhanlp【遇坑报错全程合集和解说】_第7张图片
来解决刚刚的报错,error: Setup script exited with error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: https://visualstudio.m icrosoft.com/visual-cpp-build-tools/
进官网下载
添加链接描述手动安装pyhanlp【遇坑报错全程合集和解说】_第8张图片
手动安装pyhanlp【遇坑报错全程合集和解说】_第9张图片
接着自己选择安装路径,进行安装,等待下载。安装成功后重启。
重启之后,进入pyhanlp-master的安装目录,执行python setup.py install
手动安装pyhanlp【遇坑报错全程合集和解说】_第10张图片
成功惹,继续刚刚后面的步骤。
测试在命令行输入 hanlp
手动安装pyhanlp【遇坑报错全程合集和解说】_第11张图片
成功了,也没有报错。
在命令行输入python接着输入如下

from pyhanlp import *
conten_list=HanLP.parseDependency("自然语言处理太有魅力了!")
print(conten_list)

手动安装pyhanlp【遇坑报错全程合集和解说】_第12张图片
则成功了。安装步骤结束。耗时三天。累累,菜菜,呜呜。

你可能感兴趣的:(python,python,开发语言,nlp)