windows10下用pip安装fastText和cysignals报错系统找不到指定的文件

背景

在运行知识图谱相关demo时,需要安装fastText,安装fastText又要安装cysignals,但安装时报错系统找不到文件,具体如下:

    ERROR: Command errored out with exit status 1:
     command: 'd:\develop\python\python36\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-oyvldc2g\\pyfasttext\\setup.py'"'"'; __file__='"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-oyvldc2g\\pyfasttext\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\SONGZE~1\AppData\Local\Temp\pip-install-oyvldc2g\pyfasttext\
    Complete output (42 lines):
    Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
    Collecting cysignals
      Downloading https://pypi.tuna.tsinghua.edu.cn/packages/51/5f/727aa099de5c60b3fb42cdde72097277803dabe78b177afdb5b835bbf909/cysignals-1.10.2.tar.gz (95kB)
    Requirement already satisfied: Cython>=0.28 in d:\develop\python\python36\lib\site-packages (from cysignals) (0.29.13)
    Building wheels for collected packages: cysignals
      Building wheel for cysignals (setup.py): started
      Building wheel for cysignals (setup.py): finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: 'd:\develop\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-tbk9jfyy\\cysignals\\setup.py'"'"'; __file__='"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-tbk9jfyy\\cysignals\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\SONGZE~1\AppData\Local\Temp\pip-wheel-bspvc9ol' --python-tag cp36
           cwd: C:\Users\SONGZE~1\AppData\Local\Temp\pip-install-tbk9jfyy\cysignals\
      Complete output (3 lines):
      running bdist_wheel
      running build
      error: [WinError 2] 系统找不到指定的文件。
      ----------------------------------------
      ERROR: Failed building wheel for cysignals
      Running setup.py clean for cysignals
    Failed to build cysignals
    Installing collected packages: cysignals
      Running setup.py install for cysignals: started
        Running setup.py install for cysignals: finished with status 'error'
        ERROR: Command errored out with exit status 1:
         command: 'd:\develop\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-tbk9jfyy\\cysignals\\setup.py'"'"'; __file__='"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-tbk9jfyy\\cysignals\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\SONGZE~1\AppData\Local\Temp\pip-record-66u13zhc\install-record.txt' --single-version-externally-managed --compile
             cwd: C:\Users\SONGZE~1\AppData\Local\Temp\pip-install-tbk9jfyy\cysignals\
        Complete output (3 lines):
        running install
        running build
        error: [WinError 2] 系统找不到指定的文件。
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'd:\develop\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-tbk9jfyy\\cysignals\\setup.py'"'"'; __file__='"'"'C:\\Users\\SONGZE~1\\AppData\\Local\\Temp\\pip-install-tbk9jfyy\\cysignals\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\SONGZE~1\AppData\Local\Temp\pip-record-66u13zhc\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
    Traceback (most recent call last):
      File "C:\Users\SONGZE~1\AppData\Local\Temp\pip-install-oyvldc2g\pyfasttext\setup.py", line 33, in <module>
        import cysignals
    ModuleNotFoundError: No module named 'cysignals'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\SONGZE~1\AppData\Local\Temp\pip-install-oyvldc2g\pyfasttext\setup.py", line 37, in <module>
        raise RuntimeError('cannot install cysignals with pip')
    RuntimeError: cannot install cysignals with pip
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

解决方法

只能通过源码安装的方式安装fastText了,步骤如下

pip安装pybind11

这是个fasttext源码安装的必备组件

pip install pybind11

安装visual studio

我选的版本是2015,可以用

下载解压fastText源码

源码地址https://github.com/xiamx/fastText/releases,直接下载Source Code(zip)

运行setup.py

打开cmd,切到源码根目录,运行setup.py,静候其完成。

 python setup.py install

结语

参考文章https://blog.csdn.net/m0_37870649/article/details/80935307

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值