2016-03-07 191 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