无法安装pycontractions

Unable to install pycontractions

我正在尝试通过 Jupyter Lap 或 PyCharm 安装 pycontractions,但出现错误。

也尝试过单独安装软件包,但失败了。

我正在使用 Python 3.8

的 Anaconda3 环境
   command: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\language-check_ec3c23f7676848a7a4726feaea8d1549\setup.py'"'"'; __file__='"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\language-check_ec3c23f7676848a7a4726feaea8d1549\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\grue\AppData\Local\Temp\pip-wheel-ybyl27go'
       cwd: C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\language-check_ec3c23f7676848a7a4726feaea8d1549\
  Complete output (35 lines):
  Traceback (most recent call last):
    (DELETED THE TRACEBACK)
  ----------------------------------------
> ERROR: Failed building wheel for language-check
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\setup.py'"'"'; __file__='"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\grue\AppData\Local\Temp\pip-wheel-ac89795q'
       cwd: C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\
  Complete output (11 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\pyemd
  copying pyemd\__about__.py -> build\lib.win-amd64-3.8\pyemd
  copying pyemd\__init__.py -> build\lib.win-amd64-3.8\pyemd
  running build_ext
  building 'pyemd.emd' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
>  ERROR: Failed building wheel for pyemd
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\setup.py'"'"'; __file__='"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\grue\AppData\Local\Temp\pip-record-a9qsz6i5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\grue\anaconda3\Include\pyemd'
         cwd: C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\
    Complete output (11 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\pyemd
    copying pyemd\__about__.py -> build\lib.win-amd64-3.8\pyemd
    copying pyemd\__init__.py -> build\lib.win-amd64-3.8\pyemd
    running build_ext
    building 'pyemd.emd' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\setup.py'"'"'; __file__='"'"'C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\grue\AppData\Local\Temp\pip-record-a9qsz6i5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\grue\anaconda3\Include\pyemd' Check the logs for full command output.

描述了这个问题here at the issue site of this package。这是中肯的建议:

This is actually a language-check issue. To install pycontractions, Java 8 must be used until language-check fixes their installer script:

$ sudo apt install openjdk-8-jdk
$ sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
$ pip install language-check
$ pip install pycontractions

我建议在你的 JupyterLab notebok 中完成最后两个,并将 % 放在它们前面,因为这样可以启用安装到笔记本正确位置的新魔法。

请参考以下答案: 我已经能够在 MacOS 上为 Python 3.7 成功安装 pycontractions