Jupyter在Mac上安装失败

时间:2016-03-07 15:52:32

标签: python macos jupyter failed-installation

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

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'

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

4 个答案:

答案 0 :(得分:8)

不幸的是,El Capitan随附的默认OS X Python错误包装(grrr,Apple)。他们不仅已经安装了一些相当奇怪的第三方软件包,还包括这些软件包的奇怪(旧版)和测试版。此外,他们非常system protected

这使得默认的python 而不是不友好(你已经发现)。在你的特定情况下,juypter想要安装最新版本的六个库,但系统安装的版本是一个奇怪的旧版本,不会让pip更新它(jupyter需要更新版本)。

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

  1. Python.org - 来自Python开发人员自己
  2. Homebrew - OS X的unixy包管理器,具有正常运行的python包
  3. Anaconda Python - 一个科学的python发行版,有许多难以安装的'已有的科学包装和“正常工作”。 (包括jupyter)。
  4. 如果你不知道该选择什么,我建议现在就去Anaconda。

答案 1 :(得分:2)

或者你可以试试

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

答案 2 :(得分:2)

此命令将为当前登录的用户安装input[type="text"] { font: 95% oxygen, sans-serif; border:2px solid rgb(); width: 7%; height: 2%; padding: 0px; margin-right: 0%; padding: 10px; background: #ffffff; } input[type="text1"] { font: 95% oxygen, sans-serif; border:2px solid rgba(); width: 50%; height: 2%; padding: 2px; margin-right: 0%; margin-left: 0%; padding: 10px; background: #ffffff; ,而不会忽略任何内容:

jupyter

答案 3 :(得分:0)

Ivo的答案是正确的 - 最好的解决方案是修复你的python安装。使用Homebrew的一个例子(我强烈推荐)如下:

安装Homebrew:

public class Program
{
    public static void Main()
    {
        (string a, string b) = F();

        (string a, string b) ab = F();

        Console.WriteLine($"a: {a} b: {b} ab: {ab}");


        var c = new C();

        (string d, string e) = c;

        //  Cannot implicitly convert type 'C' to '(string a, string b)'
        (string a, string b) f = c;

        Console.WriteLine($"d: {d} e: {e} f: {f}");

        //  Covariance
        (object c, object d) g = F();
        //  Implicit conversion
        (double x, double y) t = G();
    }

    public static (string a, string b) F() 
        => ("A", "B");

    public static (int x, int y) G() 
        => (0, 1);
}

public class C
{
    public String A = "A";
    public String B = "B";

    public void Deconstruct(out String a, out String b)
    {
        a = A;
        b = B;
    }
}

安装Python:

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

或Python 3:

brew install python

升级/安装:

brew install python3

安装jupyter:

pip install --upgrade pip setuptools

注意:您可能需要将pip install jupyter sudo -H

一起使用