报错内容为:
'(glm)'C:\Users\EucliwoodHellsycthe>pip install fasttext
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Collecting fasttext
Using cached https://mirrors.aliyun.com/pypi/packages/9f/3b/9a10b95eaf565358339162848863197c3f0a29b540ca22b2951df2d66a48/fasttext-0.9.3.tar.gz (73 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting pybind11>=2.2 (from fasttext)
Using cached https://mirrors.aliyun.com/pypi/packages/13/2f/0f24b288e2ce56f51c920137620b4434a38fd80583dbbe24fc2a1656c388/pybind11-2.13.6-py3-none-any.whl (243 kB)
Requirement already satisfied: setuptools>=0.7.0 in d:\anaconda3\envs\glm\lib\site-packages (from fasttext) (75.1.0)
Requirement already satisfied: numpy in d:\anaconda3\envs\glm\lib\site-packages (from fasttext) (1.24.1)
Building wheels for collected packages: fasttext
Building wheel for fasttext (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for fasttext (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [86 lines of output]
running bdist_wheel
running build
running build_py
creating build\lib.win-amd64-cpython-38\fasttext
copying python\fasttext_module\fasttext\FastText.py -> build\lib.win-amd64-cpython-38\fasttext
copying python\fasttext_module\fasttext\__init__.py -> build\lib.win-amd64-cpython-38\fasttext
creating build\lib.win-amd64-cpython-38\fasttext\util
copying python\fasttext_module\fasttext\util\util.py -> build\lib.win-amd64-cpython-38\fasttext\util
copying python\fasttext_module\fasttext\util\__init__.py -> build\lib.win-amd64-cpython-38\fasttext\util
creating build\lib.win-amd64-cpython-38\fasttext\tests
copying python\fasttext_module\fasttext\tests\test_configurations.py -> build\lib.win-amd64-cpython-38\fasttext\tests
copying python\fasttext_module\fasttext\tests\test_script.py -> build\lib.win-amd64-cpython-38\fasttext\tests
copying python\fasttext_module\fasttext\tests\__init__.py -> build\lib.win-amd64-cpython-38\fasttext\tests
running build_ext
building 'fasttext_pybind' extension
creating build\temp.win-amd64-cpython-38\Release\python\fasttext_module\fasttext\pybind
creating build\temp.win-amd64-cpython-38\Release\src
"E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-91w1g3l8\overlay\Lib\site-packages\pybind11\include -IC:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-91w1g3l8\overlay\Lib\site-packages\pybind11\include -Isrc -ID:\anaconda3\envs\glm\include -ID:\anaconda3\envs\glm\Include "-IE:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include" "-IE:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.20348.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.20348.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.20348.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.20348.0\\cppwinrt" /EHsc /Tppython/fasttext_module/fasttext/pybind/fasttext_pybind.cc /Fobuild\temp.win-amd64-cpython-38\Release\python/fasttext_module/fasttext/pybind/fasttext_pybind.obj /EHsc /DVERSION_INFO=\\\"0.9.3\\\"
fasttext_pybind.cc
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\string_view(12): warning STL4038: The contents of <string_view> are available only with C++17 or later.
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(40): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(40): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(41): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(41): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(46): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(46): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(75): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(75): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(76): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(76): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(78): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(78): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(78): error C2535: “fasttext::entry_type fasttext::Dictionary::getType(int32_t) const”: 已经定义或声明成 员函数
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(77): note: 参见“fasttext::Dictionary::getType”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C2146: 语法错误: 缺少“)”(在标识符“str”的前面)
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C3646: “str”: 未知重写说明符
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C2059: 语法错误:“)”
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C2143: 语法错误: 缺少“;”(在“const”的前面)
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): error C2208: “const int”: 没有使用此类型进行定义的成员
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): warning C4091: “ ”: 没有声明变量时忽略“const int”的左侧
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(103): error C2039: "string_view": 不是 "std" 的成员
E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\include\unordered_map(23): note: 参见“std”的声明
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(103): error C2061: 语法错误: 标识符“string_view”
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(71): error C2662: “uint32_t fasttext::Dictionary::hash(const int)”: 不能将“this”指针从“_Ty2”转换为“fasttext::Dictionary &”
with
[
_Ty2=const fasttext::Dictionary
]
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(71): note: 转换丢失限定符
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(91): note: 参见“fasttext::Dictionary::hash”的声明
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(71): note: 尝试匹配参数列表“(std::string)”时
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(72): error C2665: “fasttext::Dictionary::getId”: 没有 重载函数可以转换所有参数类型
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(76): note: 可能是“int32_t fasttext::Dictionary::getId(const int,uint32_t) const”
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(72): note: “int32_t fasttext::Dictionary::getId(const int,uint32_t) const”: 无法将参数 1 从“std::string”转换为“const int”
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(72): note: 没有可用于执行该转换的用户定义的转换运算符, 或者无法调用该运算符
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(72): note: 尝试匹配参数列表“(std::string, uint32_t)”时
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(73): error C2664: “fasttext::entry_type fasttext::Dictionary::getType(int32_t) const”: 无法将参数 1 从“std::string”转换为“int32_t”
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(73): note: 没有可用于执行该转换的用户定义的转换运算符, 或者无法调用该运算符
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-wgsw75hc\fasttext_2aac39ed5ba64931bdcb3fcc486e9c9f\src\dictionary.h(77): note: 参见“fasttext::Dictionary::getType”的声明
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(73): note: 尝试匹配参数列表“(std::string)”时
C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-91w1g3l8\overlay\Lib\site-packages\setuptools\dist.py:495: SetuptoolsDeprecationWarning: Invalid dash-separated options
!!
********************************************************************************
Usage of dash-separated 'description-file' will not be supported in future
versions. Please use the underscore name 'description_file' instead.
By 2025-Mar-03, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
********************************************************************************
!!
opt = self.warn_dash_deprecation(opt, section)
error: command 'E:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\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 fasttext
Failed to build fasttext
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (fasttext)
解决办法:手动下载 fasttext-wheel 文件 然后使用pip 安装
https://pypi.org/project/fasttext-wheel/
根据python版本 和系统架构选择下载,然后使用 pip install 安装即可