在OSX上使用pip安装pyenchant时"找不到附带的C库"

A.J*_*pal 9 macos pip pyenchant

我输入了pip install pyenchant我的shell,但它引发了两个Traceback错误:

1:

Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "/private/var/folders/q4/l70hdqjd5db2n2bdj69qrwz40000gq/T/pip_build_prernauppal/pyenchant/setup.py", line 195, in <module>
    import enchant
  File "enchant/__init__.py", line 90, in <module>
    from enchant import _enchant as _e
  File "enchant/_enchant.py", line 133, in <module>
    raise ImportError("enchant C library not found")
ImportError: enchant C library not found
Run Code Online (Sandbox Code Playgroud)

2:

Traceback (most recent call last):

    File "<string>", line 16, in <module>

    File "/private/var/folders/q4/l70hdqjd5db2n2bdj69qrwz40000gq/T/pip_build_prernauppal/pyenchant/setup.py", line 195, in <module>

        import enchant

    File "enchant/__init__.py", line 90, in <module>

        from enchant import _enchant as _e

     File "enchant/_enchant.py", line 133, in <module>

        raise ImportError("enchant C library not found")

ImportError: enchant C library not found

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/q4/l70hdqjd5db2n2bdj69qrwz40000gq/T/pip_build_prernauppal/pyenchant
Run Code Online (Sandbox Code Playgroud)

我的Mac上安装了python 2.7默认设置,但它仍然无法正常工作.我已经看过无法在Mac OSX Lion上为python 2.7安装pyenchant-1.6.5但它没有回答我的问题,因为easy_install pyenchant引发了更多的错误.

Sla*_*off 7

您需要安装enchant,这是一个C库.您可以使用Homebrew来执行此类包管理.只需输入:

brew install enchant
Run Code Online (Sandbox Code Playgroud)

在尝试pip安装之前pyenchant你应该没问题.


小智 7

试试这个 - 它在Ubuntu上对我有用.

sudo apt-get install libenchant1c2a
Run Code Online (Sandbox Code Playgroud)