lancopku / pkuseg-python

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

Win10-x64 Python 3.9.6 :pip3 install/wheel文件/python setup.py 三种方式均无法成功 #149

Open mrfoxleo opened 3 years ago

mrfoxleo commented 3 years ago

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Downloads\pkuseg-python-master\pkuseg-python-master> PS C:\Users\Downloads\pkuseg-python-master\pkuseg-python-master> python setup.py build_ext -i Traceback (most recent call last): File "setup.py", line 1, in import numpy as np ModuleNotFoundError: No module named 'numpy' PS C:\Users\Downloads\pkuseg-python-master\pkuseg-python-master> pip3 install c:\Users\212673059\Downloads\pkuseg-0.0.25-cp38-cp38-win_amd64.whl ERROR: pkuseg-0.0.25-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
WARNING: You are using pip version 21.1.3; however, version 21.2.1 is available. You should consider upgrading via the 'C:\Users\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command. PS C:\Users\Downloads\pkuseg-python-master\pkuseg-python-master> pip3 install pkuseg Collecting pkuseg Using cached pkuseg-0.0.25.tar.gz (48.8 MB) Requirement already satisfied: cython in c:\users\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pkuseg) (0.29.24) Requirement already satisfied: numpy>=1.16.0 in c:\users\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from pkuseg) (1.21.1) Building wheels for collected packages: pkuseg Building wheel for pkuseg (setup.py) ... error ERROR: Command errored out with exit status 1: command: 'C:\Users\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\setup.py'"'"'; file='"'"'C:\Users\\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\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'"'"'))' bdist_wheel -d 'C:\Users\AppData\Local\Temp\pip-wheel-qbo3q724' cwd: C:\Users\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\ Complete output (60 lines): running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\pkuseg copying pkuseg\config.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\data.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\download.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\gradient.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\model.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\optimizer.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\res_summarize.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\scorer.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\trainer.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg__init.py -> build\lib.win-amd64-3.9\pkuseg creating build\lib.win-amd64-3.9\pkuseg\dicts copying pkuseg\dicts__init.py -> build\lib.win-amd64-3.9\pkuseg\dicts creating build\lib.win-amd64-3.9\pkuseg\models copying pkuseg\models\init.py -> build\lib.win-amd64-3.9\pkuseg\models creating build\lib.win-amd64-3.9\pkuseg\postag copying pkuseg\postag\model.py -> build\lib.win-amd64-3.9\pkuseg\postag copying pkuseg\postag\init.py -> build\lib.win-amd64-3.9\pkuseg\postag creating build\lib.win-amd64-3.9\pkuseg\models\default copying pkuseg\models\default\init.py -> build\lib.win-amd64-3.9\pkuseg\models\default copying pkuseg\feature_extractor.pyx -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\inference.pyx -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\dicts\default.pkl -> build\lib.win-amd64-3.9\pkuseg\dicts copying pkuseg\postag\feature_extractor.pyx -> build\lib.win-amd64-3.9\pkuseg\postag
copying pkuseg\models\default\features.pkl -> build\lib.win-amd64-3.9\pkuseg\models\default copying pkuseg\models\default\weights.npz -> build\lib.win-amd64-3.9\pkuseg\models\default running build_ext skipping 'pkuseg\inference.cpp' Cython extension (up-to-date) cythoning pkuseg/feature_extractor.pyx to pkuseg\feature_extractor.c cythoning pkuseg/postag/feature_extractor.pyx to pkuseg/postag\feature_extractor.c
building 'pkuseg.inference' extension creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\pkuseg C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\core\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64
qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /EHsc /Tppkuseg\inference.cpp /Fobuild\temp.win-amd64-3.9\Release\pkuseg\inference.obj inference.cpp C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION pkuseg\inference.cpp(3118): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data pkuseg\inference.cpp(4284): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data pkuseg\inference.cpp(4285): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data pkuseg\inference.cpp(5108): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data pkuseg\inference.cpp(6219): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data pkuseg\inference.cpp(6807): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data pkuseg\inference.cpp(23619): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64
qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(23624): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(23639): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(23652): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64
qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(24323): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 pkuseg\inference.cpp(24339): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 pkuseg\inference.cpp(26222): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe' failed with exit code 2

ERROR: Failed building wheel for pkuseg Running setup.py clean for pkuseg Failed to build pkuseg Installing collected packages: pkuseg Running setup.py install for pkuseg ... error ERROR: Command errored out with exit status 1: command: 'C:\Users\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\setup.py'"'"'; file='"'"'C:\Users\\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\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'"'"'))' install --record 'C:\Users\AppData\Local\Temp\pip-record-rd8srpa4\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pkuseg' cwd: C:\Users\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\ Complete output (60 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\pkuseg copying pkuseg\config.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\data.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\download.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\gradient.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\model.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\optimizer.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\res_summarize.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\scorer.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\trainer.py -> build\lib.win-amd64-3.9\pkuseg copying pkuseg__init.py -> build\lib.win-amd64-3.9\pkuseg creating build\lib.win-amd64-3.9\pkuseg\dicts copying pkuseg\dicts__init.py -> build\lib.win-amd64-3.9\pkuseg\dicts creating build\lib.win-amd64-3.9\pkuseg\models copying pkuseg\models\init.py -> build\lib.win-amd64-3.9\pkuseg\models creating build\lib.win-amd64-3.9\pkuseg\postag copying pkuseg\postag\model.py -> build\lib.win-amd64-3.9\pkuseg\postag copying pkuseg\postag\init.py -> build\lib.win-amd64-3.9\pkuseg\postag creating build\lib.win-amd64-3.9\pkuseg\models\default copying pkuseg\models\default\init.py -> build\lib.win-amd64-3.9\pkuseg\models\default copying pkuseg\feature_extractor.pyx -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\inference.pyx -> build\lib.win-amd64-3.9\pkuseg copying pkuseg\dicts\default.pkl -> build\lib.win-amd64-3.9\pkuseg\dicts copying pkuseg\postag\feature_extractor.pyx -> build\lib.win-amd64-3.9\pkuseg\postag
copying pkuseg\models\default\features.pkl -> build\lib.win-amd64-3.9\pkuseg\models\default copying pkuseg\models\default\weights.npz -> build\lib.win-amd64-3.9\pkuseg\models\default running build_ext skipping 'pkuseg\inference.cpp' Cython extension (up-to-date) skipping 'pkuseg\feature_extractor.c' Cython extension (up-to-date) skipping 'pkuseg/postag\feature_extractor.c' Cython extension (up-to-date) building 'pkuseg.inference' extension creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\pkuseg C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\core\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64
qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /EHsc /Tppkuseg\inference.cpp /Fobuild\temp.win-amd64-3.9\Release\pkuseg\inference.obj inference.cpp C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION pkuseg\inference.cpp(3118): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data pkuseg\inference.cpp(4284): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data pkuseg\inference.cpp(4285): warning C4244: '=': conversion from 'npy_intp' to 'int', possible loss of data pkuseg\inference.cpp(5108): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data pkuseg\inference.cpp(6219): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data pkuseg\inference.cpp(6807): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data pkuseg\inference.cpp(23619): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64
qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(23624): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(23639): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(23652): error C2039: 'tp_print': is not a member of '_typeobject'
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64
qbz5n2kfra8p0\include\cpython/object.h(193): note: see declaration of '_typeobject' pkuseg\inference.cpp(24323): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 pkuseg\inference.cpp(24339): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3 pkuseg\inference.cpp(26222): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe' failed with exit code 2

ERROR: Command errored out with exit status 1: 'C:\Users\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\setup.py'"'"'; file='"'"'C:\Users\\AppData\Local\Temp\pip-install-xu_ok2ce\pkuseg_f62712b2e95c40ac91eeb00d128b4db3\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'"'"'))' install --record 'C:\Users\AppData\Local\Temp\pip-record-rd8srpa4\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pkuseg' Check the logs for full command output. WARNING: You are using pip version 21.1.3; however, version 21.2.1 is available. You should consider upgrading via the 'C:\Users\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command. PS C:\Users\Downloads\pkuseg-python-master\pkuseg-python-master>

mrfoxleo commented 3 years ago

mac OS 也无法安装成功,反倒是pip 可以安装到2.7

ficapy commented 3 years ago

mac OS 也无法安装成功,反倒是pip 可以安装到2.7

https://github.com/explosion/spaCy/discussions/7370#discussioncomment-455375 作者没有上传3.9的wheel包, 打包里面的文件cpp和3.9的不符合

CIETU commented 2 years ago

mac OS 也无法安装成功,反倒是pip 可以安装到2.7

explosion/spaCy#7370 (comment) 作者没有上传3.9的wheel包, 打包里面的文件cpp和3.9的不符合

请问您的python是什么版本?

lerss commented 2 years ago

Just try,

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pkuseg-py39

This works for me.

CIETU commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。  你好,我最近正在休假中,无法回复你的邮件。我将在假期结束后,尽快给你回复。

a0000001 commented 1 year ago

python 版本是3.9, pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pkuseg-py39 这个可以但是 跟着是错误 ModuleNotFoundError: No module named 'pkuseg.feature_extractor',现在怎么做呢

CIETU commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。  你好,我最近正在休假中,无法回复你的邮件。我将在假期结束后,尽快给你回复。