Jupyter在Mac上安装失败

hel*_*loB 6 python macos failed-installation jupyter

我正在尝试在我的Mac上安装Jupyter(OS X El Capitan),我收到错误以回应:

sudo pip install -U jupyter
Run Code Online (Sandbox Code Playgroud)

首先下载/安装开始很好,但后来我遇到这个:

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'
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能解决这个问题?

Ivo*_*Ivo 8

不幸的是,El Capitan随附的默认OS X Python错误包装(grrr,Apple).他们不仅已经安装了一些相当奇怪的第三方软件包,还包括这些软件包的奇怪(旧版)和测试版.此外,它们受到严重的系统保护.

这使得默认的python 非常不友好(如你所知).在你的特定情况下,juypter想要安装最新版本的六个库,但系统安装的版本是一个奇怪的旧版本,不会让pip更新它(jupyter需要更新版本).

一般来说,为了缓解所有未来的麻烦,我建议获得不同的python发行版,并将其放在你的路径上,这样它就是你的新默认值.有几个选择; 重要的是一次只使用一个(否则它们容易混淆彼此或混淆你).

  1. Python.org - 来自Python开发人员自己
  2. Homebrew - OS X的一个unixy包管理器,它有一个正常运行的python包
  3. Anaconda Python - 一个科学的python发行版,有许多"难以安装"的科学软件包已经可用并且"正常工作"(包括jupyter).

如果您不知道该选择什么,我建议您现在使用Anaconda.