无法使用pip安装gensim

时间:2017-05-12 15:53:07

标签: python-2.7 numpy

我是Python的新手,所以我正在尝试安装gensim,但它没有安装。我正在使用mac。

以下是我在终端获得的输出:

Requirement already up-to-date: 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 up-to-date: 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 up-to-date: bz2file in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from smart-open>=1.2.1->gensim)
Requirement already up-to-date: requests in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from smart-open>=1.2.1->gensim)
Installing collected packages: numpy, scipy, gensim
  Found existing installation: numpy 1.8.0rc1
    DEPRECATION: Uninstalling a distutils installed project (numpy) 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 numpy-1.8.0rc1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/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-lCcMmh-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

1 个答案:

答案 0 :(得分:1)

系统python由操作系统供应商(Apple,Canonical等)管理,旨在供其他操作系统内置工具使用。在售卖的蟒蛇中搞砸了一些东西很危险。自El Capital以来的SIP保护使得更难以打破这些事情,并且有充分的理由。 安装一个单独的python发行版,或 使用带有--user选项的pip可以避免需要提升root访问权限。您可能仍需要将用户的bin文件夹添加到$ PATH -

使用这个: sudo pip install gensim --user