【问题标题】:python - Can't install gensim in Mac OSpython - 无法在 Mac OS 中安装 gensim
【发布时间】:2016-07-02 03:21:39
【问题描述】:

当我使用 PyCharm 安装 gensim 包时,安装失败。 下面列出了错误消息:

Collecting gensim
  Using cached gensim-0.12.4-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.7.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gensim)
Collecting smart-open>=1.2.1 (from gensim)
  Using cached smart_open-1.3.2-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/six-1.10.0-py2.7.egg (from gensim)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.3 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gensim)
Requirement already satisfied (use --upgrade to upgrade): boto>=2.32 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from smart-open>=1.2.1->gensim)
Requirement already satisfied (use --upgrade to upgrade): bz2file in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from smart-open>=1.2.1->gensim)
Collecting requests==2.8.1 (from smart-open>=1.2.1->gensim)
  Using cached requests-2.8.1-py2.py3-none-any.whl
Collecting httpretty==0.8.10 (from smart-open>=1.2.1->gensim)
  Using cached httpretty-0.8.10-py2-none-any.whl
Installing collected packages: requests, httpretty, smart-open, gensim
  Found existing installation: requests 2.7.0
    Uninstalling requests-2.7.0:

You are using pip version 7.1.0, however version 8.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 299, in run
    root=options.root_path,
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 640, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 726, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 314, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/requests-2.7.0.dist-info/DESCRIPTION.rst'

而且我也是用pip安装的,但是也失败了.... 下面列出了错误消息:

chenguanyingdeMacBook-Pro:~ ChenGuanYing$ sudo pip install gensim
Password:
The directory '/Users/ChenGuanYing/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 7.1.0, however version 8.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/Users/ChenGuanYing/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting gensim
  Downloading gensim-0.12.4-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (2.5MB)
    100% |████████████████████████████████| 2.5MB 178kB/s 
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.7.0 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from gensim)
Collecting smart-open>=1.2.1 (from gensim)
  Downloading smart_open-1.3.2-py2-none-any.whl
Collecting six>=1.5.0 (from gensim)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.3 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from gensim)
Collecting boto>=2.32 (from smart-open>=1.2.1->gensim)
  Downloading boto-2.39.0-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 312kB/s 
Collecting bz2file (from smart-open>=1.2.1->gensim)
  Downloading bz2file-0.98.tar.gz
Collecting requests==2.8.1 (from smart-open>=1.2.1->gensim)
  Downloading requests-2.8.1-py2.py3-none-any.whl (497kB)
    100% |████████████████████████████████| 499kB 948kB/s 
Collecting httpretty==0.8.10 (from smart-open>=1.2.1->gensim)
  Downloading httpretty-0.8.10-py2-none-any.whl
Installing collected packages: boto, bz2file, requests, httpretty, smart-open, six, gensim
  Running setup.py install for bz2file
  Found existing installation: requests 2.7.0
    Uninstalling requests-2.7.0:
      Successfully uninstalled requests-2.7.0
  Found existing installation: six 1.4.1
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 299, in run
    root=options.root_path,
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 640, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 726, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 314, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-vV05uu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

感谢您的帮助,很抱歉我的英语很差。

【问题讨论】:

    标签: python macos python-2.7 pycharm gensim


    【解决方案1】:

    要授予自己更改该文件夹内容的权限,您可以执行以下操作:

    sudo chown -R $(whoami):admin /library/Python/2.7
    

    遇到 errno:13 时这对我有用

    【讨论】:

      【解决方案2】:

      Gensim 需要 Python、SciPy 和 Numpy 及其适当的版本。 你可以在这里找到他们:https://radimrehurek.com/gensim/install.html 我建议您使用 Anaconda 安装它们。

      【讨论】:

        【解决方案3】:

        首先,我安装 NumPy 和 SciPy。 那我就安装gensim成功了!

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-01-09
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多