“enchant C library not found” while installing pyenchant using pip on OSX

て烟熏妆下的殇ゞ 提交于 2019-12-09 15:36:37

问题


I typed in pip install pyenchant into my shell, but it raised two Traceback errors:

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

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

I have python 2.7 default installed on my mac, but it still isn't working. I have already looked at Unable to install pyenchant-1.6.5 for python 2.7 on Mac OSX Lion but it doesn't answer my question, as easy_install pyenchant raises even more errors.


回答1:


You need to install enchant, which is a C library. You can use Homebrew, to do this kind of package management. Just enter:

brew install enchant

Before trying to pip install pyenchant and you should be fine.




回答2:


Try this - It worked for me on Ubuntu.

sudo apt-get install libenchant1c2a



回答3:


Try either sudo pip install or sudo easy install.




回答4:


[nltk_data] Error loading enchant: Package 'enchant' not found in

No. if you get this problem, you are supposed to install it like this:

$ sudo easy_install pyenchant

it is not an nltk package, it is a package on its own.




回答5:


sudo easy_install

sudo because MAC permissions are usually messed up




回答6:


Try a pip install, an easy_install, and a brew.




回答7:


You have to download the NLTK package. That is how you get Pyenchant running. But if your building a grammar checker, pyenchant is not advisable because it only grammar checks two words. You should consider building a grammar checker on your own by starting with an autocomplete word completion from here: How to code autocompletion in python?




回答8:


For windows: download the required .exe file based on version from https://pypi.python.org/simple/pyenchant/ and pip install pyenchant



来源:https://stackoverflow.com/questions/21083059/enchant-c-library-not-found-while-installing-pyenchant-using-pip-on-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!