无法在 Windows 上安装 python Polyglot 包

Can't install python Polyglot package on Windows

我正在尝试使用以下命令安装 Polyglot 包:

pip install polyglot

我收到以下信息:

Collecting polyglot
  Using cached polyglot-15.10.03-py2.py3-none-any.whl
Collecting pycld2>=0.3 (from polyglot)
Requirement already satisfied (use --upgrade to upgrade): futures>=2.1.6 in d:\program files\winpython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages (from polyglot)
Requirement already satisfied (use --upgrade to upgrade): wheel>=0.23.0 in d:\program files\winpython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages (from polyglot)
Collecting PyICU>=1.8 (from polyglot)
  Using cached PyICU-1.9.3.tar.gz
Collecting morfessor>=2.0.2a1 (from polyglot)
Requirement already satisfied (use --upgrade to upgrade): six>=1.7.3 in d:\program files\winpython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages (from polyglot)
Building wheels for collected packages: PyICU
  Running setup.py bdist_wheel for PyICU ... error
  Complete output from command "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\python.exe" -u -c "import setuptools, tokenize;__file__='C:\Users\revuze\AppData\Local\Temp\pip-build-h2bmp43j\PyICU\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\revuze\AppData\Local\Temp\tmpphoimlejpip-wheel- --python-tag cp34:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.4
  copying icu.py -> build\lib.win-amd64-3.4
  copying PyICU.py -> build\lib.win-amd64-3.4
  copying docs.py -> build\lib.win-amd64-3.4
  running build_ext
  building '_icu' extension
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\revuze\AppData\Local\Temp\pip-build-h2bmp43j\PyICU\setup.py", line 115, in <module>
      py_modules=['icu', 'PyICU', 'docs'])
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\wheel\bdist_wheel.py", line 179, in run
      self.run_command('build')
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\command\build.py", line 126, in run
      self.run_command(cmd_name)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\setuptools\command\build_ext.py", line 49, in run
      _build_ext.run(self)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\Cython\Distutils\build_ext.py", line 164, in run
      _build_ext.build_ext.run(self)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\command\build_ext.py", line 339, in run
      self.build_extensions()
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\Cython\Distutils\build_ext.py", line 172, in build_extensions
      self.build_extension(ext)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\setuptools\command\build_ext.py", line 174, in build_extension
      _build_ext.build_extension(self, ext)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\command\build_ext.py", line 503, in build_extension
      depends=ext.depends)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\msvc9compiler.py", line 460, in compile
      self.initialize()
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\msvc9compiler.py", line 371, in initialize
      vc_env = query_vcvarsall(VERSION, plat_spec)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\setuptools\msvc9_support.py", line 52, in query_vcvarsall
      return unpatched['query_vcvarsall'](version, *args, **kwargs)
    File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
      raise ValueError(str(list(result.keys())))
  ValueError: ['path']

  ----------------------------------------
  Failed building wheel for PyICU
  Running setup.py clean for PyICU
Failed to build PyICU
Installing collected packages: pycld2, PyICU, morfessor, polyglot
  Running setup.py install for PyICU ... error
    Complete output from command "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\python.exe" -u -c "import setuptools, tokenize;__file__='C:\Users\revuze\AppData\Local\Temp\pip-build-h2bmp43j\PyICU\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\revuze\AppData\Local\Temp\pip-lkjedrat-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.4
    copying icu.py -> build\lib.win-amd64-3.4
    copying PyICU.py -> build\lib.win-amd64-3.4
    copying docs.py -> build\lib.win-amd64-3.4
    running build_ext
    building '_icu' extension
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\revuze\AppData\Local\Temp\pip-build-h2bmp43j\PyICU\setup.py", line 115, in <module>
        py_modules=['icu', 'PyICU', 'docs'])
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\command\install.py", line 539, in run
        self.run_command('build')
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\command\build.py", line 126, in run
        self.run_command(cmd_name)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\setuptools\command\build_ext.py", line 49, in run
        _build_ext.run(self)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\Cython\Distutils\build_ext.py", line 164, in run
        _build_ext.build_ext.run(self)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\Cython\Distutils\build_ext.py", line 172, in build_extensions
        self.build_extension(ext)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\setuptools\command\build_ext.py", line 174, in build_extension
        _build_ext.build_extension(self, ext)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\command\build_ext.py", line 503, in build_extension
        depends=ext.depends)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\msvc9compiler.py", line 460, in compile
        self.initialize()
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\msvc9compiler.py", line 371, in initialize
        vc_env = query_vcvarsall(VERSION, plat_spec)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\setuptools\msvc9_support.py", line 52, in query_vcvarsall
        return unpatched['query_vcvarsall'](version, *args, **kwargs)
      File "D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
        raise ValueError(str(list(result.keys())))
    ValueError: ['path']

    ----------------------------------------
Command ""D:\Program Files\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\python.exe" -u -c "import setuptools, tokenize;__file__='C:\Users\revuze\AppData\Local\Temp\pip-build-h2bmp43j\PyICU\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\revuze\AppData\Local\Temp\pip-lkjedrat-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\revuze\AppData\Local\Temp\pip-build-h2bmp43j\PyICU\

起初我遇到了 C++ 编译器的问题,我已经解决了,现在我遇到了这个问题。我搜索了类似的问题,大多数评论建议安装 Microsoft Windows SDK(以解决编译器的 64 位问题),我没有运气。

我正在 Windows 10 64 机器上 Python 3.4.

因为我怀疑您在 Windows 上没有很好的编译代码经验,您最好尝试使用 Anaconda python 发行版,它具有大部分Python 个包已经编译。

安装后,您只需使用 conda 而不是 pip 来安装新软件包。如果需要,您仍然可以使用 pip。

如果你现在有 Windows vs2010 编译器,你可以试试这个:

  • 启动"D:\Program Files\WinPython-64bit-3.4.4.2\make_cython_use_vc.bat"
  • 然后启动 "Winpython Command Prompt" 和 "pip install polyglot"

如果失败,恢复到之前的状态:

  • 启动"D:\Program Files\WinPython-64bit-3.4.4.2\make_cython_use_mingw.bat"

遗憾的是,Windows 时软件包还不稳定。在尝试 pip 和 conda install 没有运气之后。这是我为了让它在 Python 3.6 环境 运行 和 Windows 10 64 位上工作所做的。

我通过 VS 2015 社区版安装了 Visual C++ 2015 构建工具(包括 Windows SDK),并且已经安装了 Numpy。

我从Unofficial Windows Binaries for Python Extension Packages下载了正确的依赖包(PyICU和pycld2)并且:

pip install PyICU-1.9.8-cp36-cp36m-win_amd64.whl
pip install pycld2-0.31-cp36-cp36m-win_amd64.whl

所以 cp36 匹配我的 Python env.version,win 匹配 Windows,amd64 匹配 64 位。下载与您的系统匹配的正确车轮。

之后,我从 GitHub

克隆并安装了软件包
git clone https://github.com/aboSamoor/polyglot.git
cd polyglot
python setup.py install

因此,如果您想安装多语言,请按照以下步骤操作:

使用git安装polyglot如果你没有然后conda安装git然后使用这个命令

pip install git+https://github.com/aboSamoor/polyglot@master

该文件将自动从该站点下载,无需重新安装。

最好的方法是从 https://github.com/aboSamoor/polyglot/tarball/master 下载然后

python pip install aboSamoor-polyglot-15.10.03-69-gaf5059f.tar.gz