lancopku / pkuseg-python

pkuseg多领域中文分词工具; The pkuseg toolkit for multi-domain Chinese word segmentation
MIT License
6.53k stars 985 forks source link

Win10 3.10.14 安装失败 #175

Open StChenHaoGitHub opened 7 months ago

StChenHaoGitHub commented 7 months ago

尊敬的北京大学的作者:

我是一个在读研究生,目前在挑选和使用项目中可以使用的NLP,工具,但是在下载贵库的时候失败了。 我看文档中是支持windows x64位的系统的,我也尝试了文档中的各个安装命令,也看来一下Issues中的问题,好像还没解决,我一路安装jieba Hanlp SnowNlP thulac(清华)和LTP(哈工大)的过来我的环境的环境应该没有问题,我还选择了目前python安全版本中的最新的3.10版本。

希望能得到答复。

(NLP) PS D:\桌面\分析工具盘点> pip install pkuseg
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pkuseg
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/64/3a/090a533c7f0682d653633cfd2d33e9aab3e671379fb199aeb7fa9bd3c34a/pkuseg-0.0.25.tar.gz (48.8 MB)
  Preparing metadata (setup.py) ... done
Collecting cython (from pkuseg)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/47/82/135229b426f42c75e19a4ea1f0f63d046be1db709335e86cfaab768d680c/Cython-3.0.9-cp310-cp310-win_amd64.whl (2.8 MB)
Requirement already satisfied: numpy>=1.16.0 in e:\programdata\anaconda3\envs\nlp\lib\site-packages (from pkuseg) (1.26.4)
Building wheels for collected packages: pkuseg
  Building wheel for pkuseg (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [52 lines of output]
      E:\ProgramData\anaconda3\envs\NLP\lib\site-packages\setuptools\__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\config.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\data.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\download.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\gradient.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\model.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\optimizer.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\res_summarize.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\scorer.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\trainer.py -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\__init__.py -> build\lib.win-amd64-cpython-310\pkuseg
      creating build\lib.win-amd64-cpython-310\pkuseg\dicts
      copying pkuseg\dicts\__init__.py -> build\lib.win-amd64-cpython-310\pkuseg\dicts
      creating build\lib.win-amd64-cpython-310\pkuseg\models
      copying pkuseg\models\__init__.py -> build\lib.win-amd64-cpython-310\pkuseg\models
      creating build\lib.win-amd64-cpython-310\pkuseg\postag
      copying pkuseg\postag\model.py -> build\lib.win-amd64-cpython-310\pkuseg\postag
      copying pkuseg\postag\__init__.py -> build\lib.win-amd64-cpython-310\pkuseg\postag
      creating build\lib.win-amd64-cpython-310\pkuseg\models\default
      copying pkuseg\models\default\__init__.py -> build\lib.win-amd64-cpython-310\pkuseg\models\default
      copying pkuseg\feature_extractor.pyx -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\inference.pyx -> build\lib.win-amd64-cpython-310\pkuseg
      copying pkuseg\dicts\default.pkl -> build\lib.win-amd64-cpython-310\pkuseg\dicts
      copying pkuseg\postag\feature_extractor.pyx -> build\lib.win-amd64-cpython-310\pkuseg\postag
      copying pkuseg\models\default\features.pkl -> build\lib.win-amd64-cpython-310\pkuseg\models\default
      copying pkuseg\models\default\weights.npz -> build\lib.win-amd64-cpython-310\pkuseg\models\default
      running build_ext
      Compiling pkuseg/inference.pyx because it changed.
      [1/1] Cythonizing pkuseg/inference.pyx
      building 'pkuseg.inference' extension
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      creating build\temp.win-amd64-cpython-310\Release\pkuseg
      "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IE:\ProgramData\anaconda3\envs\NLP\lib\site-packages\numpy\
core\include -IE:\ProgramData\anaconda3\envs\NLP\include -IE:\ProgramData\anaconda3\envs\NLP\Include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-ID:\Window
s Kits\10\include\10.0.10240.0\ucrt" "-ID:\Windows Kits\10\include\10.0.10240.0\shared" "-ID:\Windows Kits\10\include\10.0.10240.0\um" "-ID:\Windows Kits\10\include\10.0.10240.0\wi
nrt" /EHsc /Tppkuseg/inference.cpp /Fobuild\temp.win-amd64-cpython-310\Release\pkuseg/inference.obj
      inference.cpp
      e:\programdata\anaconda3\envs\nlp\include\pyconfig.h(200): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pkuseg
  Running setup.py clean for pkuseg
Failed to build pkuseg
ERROR: Could not build wheels for pkuseg, which is required to install pyproject.toml-based projects
learnmore33 commented 7 months ago

我也遇到同样的问题,请问你解决了吗

doggy8088 commented 6 months ago

@StChenHaoGitHub @learnmore33

因为 Cpython 会调用 Visual Studio 的 cl.exe 来链接函式库,你可能需要额外安装 Visual Studio 的 C++ 支持,才能让你找到 basetsd.h

image

如果还不行,请安装 Windows 10 SDK

image

StChenHaoGitHub commented 6 months ago

@doggy8088 您好,由于服务器中可能不让安装vscode,所以我去微软的官网下载了c++支持安装包,并按照提示进行了安装到了本地,可能不是用vscode运行,所以还是出现了上面的错误,但是依旧非常感谢您的回复。

capp-adocia commented 3 months ago

这个我知道,我刚好也遇到了这个问题,其实不用安装vs,你仅需要将你的python版本降级到3.8及以下,我之前用3.9安装是失败,信我包成功的

lcyyyyyyyyyyy commented 3 months ago

@.***,本次回复为系统自动回复!