如何解决在Windows上安装fastText库时遇到的问题?
我刚入门这个领域,正在尝试在自然语言处理(NLP)方面使用不同的模型。当我试图通过命令提示符安装fastText库时,出现了一个错误:
pip install wheel
pip install pybind11
pip install fasttext
错误信息是:
Collecting fasttext
Using cached fasttext-0.9.2.tar.gz (68 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11>=2.2 in c:\users\manid\appdata\local\programs\python\python312\lib\site-packages (from fasttext) (2.11.1)
Requirement already satisfied: setuptools>=0.7.0 in c:\users\manid\appdata\local\programs\python\python312\lib\site-packages (from fasttext) (69.2.0)
Requirement already satisfied: numpy in c:\users\manid\appdata\local\programs\python\python312\lib\site-packages (from fasttext) (1.26.4)
Building wheels for collected packages: fasttext
Building wheel for fasttext (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [75 lines of output]
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\dist.py:476: 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 2024-Sep-26, 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)
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-312
creating build\lib.win-amd64-cpython-312\fasttext
copying python\fasttext_module\fasttext\FastText.py -> build\lib.win-amd64-cpython-312\fasttext
copying python\fasttext_module\fasttext\__init__.py -> build\lib.win-amd64-cpython-312\fasttext
creating build\lib.win-amd64-cpython-312\fasttext\util
copying python\fasttext_module\fasttext\util\util.py -> build\lib.win-amd64-cpython-312\fasttext\util
copying python\fasttext_module\fasttext\util\__init__.py -> build\lib.win-amd64-cpython-312\fasttext\util
creating build\lib.win-amd64-cpython-312\fasttext\tests
copying python\fasttext_module\fasttext\tests\test_configurations.py -> build\lib.win-amd64-cpython-312\fasttext\tests
copying python\fasttext_module\fasttext\tests\test_script.py -> build\lib.win-amd64-cpython-312\fasttext\tests
copying python\fasttext_module\fasttext\tests\__init__.py -> build\lib.win-amd64-cpython-312\fasttext\tests
running build_ext
building 'fasttext_pybind' extension
creating build\temp.win-amd64-cpython-312
creating build\temp.win-amd64-cpython-312\Release
creating build\temp.win-amd64-cpython-312\Release\python
creating build\temp.win-amd64-cpython-312\Release\python\fasttext_module
creating build\temp.win-amd64-cpython-312\Release\python\fasttext_module\fasttext
creating build\temp.win-amd64-cpython-312\Release\python\fasttext_module\fasttext\pybind
creating build\temp.win-amd64-cpython-312\Release\src
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include -IC:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include -Isrc -IC:\Users\manid\AppData\Local\Programs\Python\Python312\include -IC:\Users\manid\AppData\Local\Programs\Python\Python312\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tppython/fasttext_module/fasttext/pybind/fasttext_pybind.cc /Fobuild\temp.win-amd64-cpython-312\Release\python/fasttext_module/fasttext/pybind/fasttext_pybind.obj /EHsc /DVERSION_INFO=\\\"0.9.2\\\"
fasttext_pybind.cc
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2065: 'ssize_t': undeclared identifier
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2672: 'pybind11::init': no matching overloaded function found
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1932): note: could be 'Ret pybind11::init(CFunc &&,AFunc &&)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::init': invalid template argument for 'CFunc', type expected
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1924): note: or 'Ret pybind11::init(Func &&)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::init': invalid template argument for 'Func', type expected
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: or 'pybind11::detail::initimpl::constructor<Args...> pybind11::init(void)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::init': invalid template argument for 'Args', type expected
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): error C2672: 'pybind11::class_<fasttext::Vector>::def': no matching overloaded function found
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1631): note: could be 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(pybind11::detail::initimpl::pickle_factory<Args...> &&,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1625): note: or 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(pybind11::detail::initimpl::factory<Args...> &&,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1618): note: or 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const pybind11::detail::initimpl::alias_constructor<Args...> &,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1611): note: or 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const pybind11::detail::initimpl::constructor<Args...> &,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1599): note: or 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const T &,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1574): note: or 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const char *,Func &&,const Extra &...)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(171): note: 'pybind11::class_<fasttext::Vector> &pybind11::class_<fasttext::Vector>::def(const char *,Func &&,const Extra &...)': expects 3 arguments - 1 provided
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2065: 'ssize_t': undeclared identifier
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2065: 'ssize_t': undeclared identifier
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2672: 'pybind11::init': no matching overloaded function found
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1932): note: could be 'Ret pybind11::init(CFunc &&,AFunc &&)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::init': invalid template argument for 'CFunc', type expected
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1924): note: or 'Ret pybind11::init(Func &&)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::init': invalid template argument for 'Func', type expected
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1912): note: or 'pybind11::detail::initimpl::constructor<Args...> pybind11::init(void)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::init': invalid template argument for 'Args', type expected
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): error C2672: 'pybind11::class_<fasttext::DenseMatrix>::def': no matching overloaded function found
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1631): note: could be 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(pybind11::detail::initimpl::pickle_factory<Args...> &&,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1625): note: or 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(pybind11::detail::initimpl::factory<Args...> &&,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1618): note: or 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const pybind11::detail::initimpl::alias_constructor<Args...> &,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1611): note: or 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const pybind11::detail::initimpl::constructor<Args...> &,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1599): note: or 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const T &,const Extra &...)'
C:\Users\manid\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include\pybind11\pybind11.h(1574): note: or 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const char *,Func &&,const Extra &...)'
python/fasttext_module/fasttext/pybind/fasttext_pybind.cc(185): note: 'pybind11::class_<fasttext::DenseMatrix> &pybind11::class_<fasttext::DenseMatrix>::def(const char *,Func &&,const Extra &...)': expects 3 arguments - 1 provided
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.39.33519\\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
Running setup.py clean for fasttext
Failed to build fasttext
ERROR: Could not build wheels for fasttext, which is required to install pyproject.toml-based projects
1 个回答
暂无回答