簡體   English   中英

python-無法在Mac OS中安裝gensim

[英]python - Can't install gensim in Mac OS

當我使用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'

感謝您的幫助,對不起,我的英語非常好。

要授予自己更改該文件夾內容的權限,可以執行以下操作:

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

遇到errno時這對我有用:13

首先,我安裝NumPy和SciPy。 然后,我成功安裝了gensim!

Gensim需要Python,SciPy和Numpy及其相應的版本。 您可以在以下位置找到它們: https ://radimrehurek.com/gensim/install.html我建議您使用Anaconda安裝它們。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM