2016-03-07 157 views
5

我想在我的Mac(OS X埃爾卡皮坦)安裝Jupyter,我得到一個錯誤響應:Jupyter安裝失敗在Mac

sudo pip install -U jupyter 

起初,下載/安裝開始罰款,但後來我碰到這個:

Installing collected packages: six, singledispatch, certifi, backports-abc, tornado, jupyter-core, pyzmq, jupyter-client, functools32, jsonschema, nbformat, pygments, mistune, MarkupSafe, jinja2, nbconvert, path.py, pickleshare, simplegeneric, setuptools, gnureadline, appnope, ptyprocess, pexpect, ipython, ipykernel, terminado, notebook, ipywidgets, jupyter-console, qtconsole, jupyter 
    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/basecommand.py", line 209, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run 
    prefix=options.prefix_path, 
    File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 726, in install 
    requirement.uninstall(auto_confirm=True) 
    File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 746, in uninstall 
    paths_to_remove.remove(auto_confirm) 
    File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove 
    renames(path, new_path) 
    File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, 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-ByX5xW-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info' 

我能做些什麼來解決這個問題?

+0

至少它不只是進入無限循環沒有任何輸出:/(例如) –

回答

8

El Capitan提供的默認OS X Python不幸被錯誤封裝(grrr,Apple)。他們不僅發佈了一些已經安裝的相當奇怪的第三方軟件包,而且還發布了這些軟件包的奇怪(舊)和測試版。此外,他們沉重地system protected

這使得默認python 而不是不友好的做(如你已經發現的)。在你的具體情況下,juypter想要安裝六庫的最新版本,但系統安裝版本是一個奇怪的舊版本,不會讓pip更新它(jupyter需要更新的版本)。

一般來說,爲了減輕所有未來的麻煩,我建議獲得python的不同分佈,並將它放在你的路徑上,因此它是你的新默認值。有幾個選擇;重要的是一次只使用一個(否則他們容易混淆彼此或混淆你)。

  1. Python.org - 從Python開發者自己
  2. Homebrew - 甲科學蟒分佈,具有許多「更難於 - 爲OS X,它有一個常運轉蟒包
  3. Anaconda Python一個unixy包管理「安裝」已有的科學軟件包和「正在工作」(包括jupyter)。

如果您不知道要選擇什麼,我建議現在用Anaconda。

+0

非常感謝這個徹底的答案。我喜歡Python,並已使用它一年多,但我總是遇到這些問題。確認Mac OS系統設置得不是很好,這是非常有幫助的。 – helloB

0

Ivo的答案是正確的 - 最好的解決辦法是修復你的python安裝。使用自制(我強烈建議)的一個例子是下面:

安裝自制:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
brew update 
brew upgrade 

安裝Python:

brew install python 

或Python 3:

brew install python3 

升級/安裝:

pip install --upgrade pip setuptools 

安裝jupyter:

pip install jupyter 

注意:您可能需要使用sudo -Hpip install

0

或者你可以只是嘗試

sudo pip install -U jupyter --upgrade --ignore-installed six