【问题标题】:How to install mecab-python3 on mac OS using pip如何使用 pip 在 mac OS 上安装 mecab-python3
【发布时间】:2019-04-02 03:25:48
【问题描述】:

我正在尝试通过pip install mecab-python3 安装mecab-python3,但出现以下错误。

Collecting mecab-python3
Using cached https://files.pythonhosted.org/packages/e2/02/d35d4342a37a36f953939d098bc1d38928932b62907a54d4a1aa9c37da9b/mecab-python3-0.8.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/rz/m973jrzs5nv6x_h26ys14nxm0000gp/T/pip-install-nr4vtspq/mecab-python3/setup.py", line 6, in <module>
    with open('README.rst') as readme_file:
FileNotFoundError: [Errno 2] No such file or directory: 'README.rst'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/rz/m973jrzs5nv6x_h26ys14nxm0000gp/T/pip-install-nr4vtspq/mecab-python3/

仅供参考,这里是 pip 的版本:pip 18.1 from /Users/XXX/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pip (python 3.6)

谁能帮帮我?


已更新。

关注mmedina的评论后,出现如下错误。

/Users/XXX/.pyenv/versions/anaconda3-5.2.0/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
#include_next <limits.h>  /* recurse down to the real one */
                                                         ^
error: command 'gcc' failed with exit status 1

【问题讨论】:

    标签: python python-3.x macos anaconda mecab


    【解决方案1】:

    终于,我可以解决这个问题了。原因是 MacOS Mojave。

    许多与gcc 问题相关的帖子都说“运行xcode-select --install”。

    但是,在 MacOS Mojave 上,我们需要运行

    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

    因为目前xcode-select无法跟上 MacOS Mojave。

    【讨论】:

      【解决方案2】:

      问题是下载的 tar.gz 文件不包含文件 README.rst。我检查了存储库https://github.com/SamuraiT/mecab-python3,我认为很快就会有修复,但如果您赶时间,可以执行以下操作来安装它:

      1. 下载mecab-python3

        $ pip 下载 mecab-python3

      2. 解压文件

        $ tar xfv mecab-python3-0.8.2.tar.gz

        这将创建目录 mecab-python3

      3. 克隆仓库https://github.com/SamuraiT/mecab-python3

        $ git clone https://github.com/SamuraiT/mecab-python3

      4. 将 README.rst 从克隆的存储库复制到在步骤 1 中创建的 mecab-python3 目录,然后将目录更改为该目录。

      5. 运行:

        $ python setup.py build

        $ python setup.py 安装

      您将安装 mecab-python3。确认

      $ pip show mecab-python3
      

      【讨论】:

      • 感谢您的评论。运行python setup.py build时,出现gcc错误。我更新了这篇文章的描述,如果你能找到答案,我将不胜感激。
      • gcc 问题是特定于您的环境的,但我很高兴您能解决它。如果我的回复解决了您的问题,请将其设置为接受的答案:) 谢谢!
      猜你喜欢
      • 2022-01-25
      • 2018-10-30
      • 2013-09-29
      • 1970-01-01
      • 2021-04-07
      • 2015-04-03
      • 2014-08-22
      • 2023-03-30
      • 2013-12-03
      相关资源
      最近更新 更多