0

我正在尝试在 Python 3.7 版上从 Pypi 安装 GloVe 包,但它不断返回下面写的相同错误。有什么方法可以使用手套吗?我也尝试从https://github.com/stanfordnlp/GloVe安装它, 但它也以错误结束。谢谢您的帮助!

pip install glove Collecting glove   Using cached glove-1.0.2.tar.gz (44 kB) Requirement already satisfied: numpy in d:\anaconda\lib\site-packages (from glove) (1.16.4) Building wheels for collected packages: glove   Building wheel for glove (setup.py) ... error   ERROR: Command errored out with exit status 1:    command: 'd:\anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-vlqonr2u\\glove\\setup.py'"'"';
__file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-vlqonr2u\\glove\\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\Dell\AppData\Local\Temp\pip-wheel-c3ip0qox'
       cwd: C:\Users\Dell\AppData\Local\Temp\pip-install-vlqonr2u\glove\   Complete output (67 lines):   running bdist_wheel   running build   running build_py   creating build   creating build\lib.win-amd64-3.7   creating build\lib.win-amd64-3.7\glove   copying glove\glove.py -> build\lib.win-amd64-3.7\glove   copying glove\__init__.py -> build\lib.win-amd64-3.7\glove   running egg_info   writing glove.egg-info\PKG-INFO   writing dependency_links to glove.egg-info\dependency_links.txt   writing requirements to glove.egg-info\requires.txt   writing top-level names to glove.egg-info\top_level.txt   reading manifest file 'glove.egg-info\SOURCES.txt'   Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\Dell\AppData\Local\Temp\pip-install-vlqonr2u\glove\setup.py", line 85, in <module>
      include_package_data=True,
    File "d:\anaconda\lib\site-packages\setuptools\__init__.py", line 144, in setup
      return distutils.core.setup(**attrs)
    File "d:\anaconda\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "d:\anaconda\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "d:\anaconda\lib\site-packages\wheel\bdist_wheel.py", line 223, in run
      self.run_command('build')
    File "d:\anaconda\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "d:\anaconda\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "d:\anaconda\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 53, in run
      self.build_package_data()
    File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 118, in build_package_data
      for package, src_dir, build_dir, filenames in self.data_files:
    File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 66, in __getattr__
      self.data_files = self._get_data_files()
    File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 82, in _get_data_files
      self.analyze_manifest()
    File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 138, in analyze_manifest
      self.run_command('egg_info')
    File "d:\anaconda\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 297, in run
      self.find_sources()
    File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 304, in find_sources
      mm.run()
    File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 535, in run
      self.add_defaults()
    File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 579, in add_defaults
      self.read_manifest()
    File "d:\anaconda\lib\site-packages\setuptools\command\sdist.py", line 220, in read_manifest
      self.filelist.append(line)
    File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 477, in append
      path = convert_path(item)
    File "d:\anaconda\lib\distutils\util.py", line 110, in convert_path
      raise ValueError("path '%s' cannot be absolute" % pathname)   ValueError: path '/Users/jonathanraiman/Desktop/Coding/python_packages/glove/glove/glove_inner.cpp' cannot be absolute   ----------------------------------------   ERROR: Failed building wheel for glove   Running setup.py clean for glove Failed to build glove Installing collected packages: glove
    Running setup.py install for glove ... error
    ERROR: Command errored out with exit status 1:
     command: 'd:\anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-vlqonr2u\\glove\\setup.py'"'"';
__file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-vlqonr2u\\glove\\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\Dell\AppData\Local\Temp\pip-record-mo9f0x8b\install-record.txt'
--single-version-externally-managed --compile --install-headers 'd:\anaconda\Include\glove'
         cwd: C:\Users\Dell\AppData\Local\Temp\pip-install-vlqonr2u\glove\
    Complete output (69 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\glove
    copying glove\glove.py -> build\lib.win-amd64-3.7\glove
    copying glove\__init__.py -> build\lib.win-amd64-3.7\glove
    running egg_info
    writing glove.egg-info\PKG-INFO
    writing dependency_links to glove.egg-info\dependency_links.txt
    writing requirements to glove.egg-info\requires.txt
    writing top-level names to glove.egg-info\top_level.txt
    reading manifest file 'glove.egg-info\SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Dell\AppData\Local\Temp\pip-install-vlqonr2u\glove\setup.py", line 85, in <module>
        include_package_data=True,
      File "d:\anaconda\lib\site-packages\setuptools\__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "d:\anaconda\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "d:\anaconda\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "d:\anaconda\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "d:\anaconda\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "d:\anaconda\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "d:\anaconda\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "d:\anaconda\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 53, in run
        self.build_package_data()
      File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 118, in build_package_data
        for package, src_dir, build_dir, filenames in self.data_files:
      File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 66, in __getattr__
        self.data_files = self._get_data_files()
      File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 82, in _get_data_files
        self.analyze_manifest()
      File "d:\anaconda\lib\site-packages\setuptools\command\build_py.py", line 138, in analyze_manifest
        self.run_command('egg_info')
      File "d:\anaconda\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "d:\anaconda\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 297, in run
        self.find_sources()
      File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 304, in find_sources
        mm.run()
      File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 535, in run
        self.add_defaults()
      File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 579, in add_defaults
        self.read_manifest()
      File "d:\anaconda\lib\site-packages\setuptools\command\sdist.py", line 220, in read_manifest
        self.filelist.append(line)
      File "d:\anaconda\lib\site-packages\setuptools\command\egg_info.py", line 477, in append
        path = convert_path(item)
      File "d:\anaconda\lib\distutils\util.py", line 110, in convert_path
        raise ValueError("path '%s' cannot be absolute" % pathname)
    ValueError: path '/Users/jonathanraiman/Desktop/Coding/python_packages/glove/glove/glove_inner.cpp' cannot be absolute
    ---------------------------------------- ERROR: Command errored out with exit status 1: 'd:\anaconda\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-vlqonr2u\\glove\\setup.py'"'"';
__file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-vlqonr2u\\glove\\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\Dell\AppData\Local\Temp\pip-record-mo9f0x8b\install-record.txt'
--single-version-externally-managed --compile --install-headers 'd:\anaconda\Include\glove' Check the logs for full command output.<
4

2 回答 2

0

你可以源安装它。然后从github克隆它

pip install .
于 2020-02-17T02:28:49.397 回答
0

如果您可以对原始 GloVe 实现进行轻微修改,则可以使用“手套”。它使用与 GloVe 相同的算法,但对目标函数进行了矢量化,并且还使用了“热启动”(手套比手套更暖和)。

来自文档:mittens 从通用的预训练表示开始,并将它们调整到一个专门的领域。
pip install -U mittens
然后:
from mittens import GloVe

https://github.com/roamanalytics/mittens#mittens

于 2020-09-03T17:36:36.503 回答