在M上安装Jupyter失败

2024-04-23 11:28:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在我的Mac(OS X El Capitan)上安装Jupyter,但我收到一个错误响应:

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'

我能做什么来解决这个问题?


Tags: installpippathinpypackageslinelibrary
3条回答

ElCapitan附带的默认OSX Python不幸地被严重地错误打包(grrr,Apple)。他们不仅发布了一些已经安装的奇怪的第三方软件包,而且还发布了这些软件包的奇怪(旧)和beta版本。而且,它们的重量很大。

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

一般来说,为了减轻将来所有的麻烦,我建议使用不同的python发行版,并将其放在您的路径上,这样它就是您的新默认版本。有两种选择;最重要的是一次只使用一种(否则它们很容易混淆对方,或混淆你)。

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

如果你不知道该选什么,我建议现在就和Python一起去。

此命令将为当前登录的用户安装jupyter,而不会忽略任何内容:

sudo pip install --user jupyter

或者你可以试试

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

相关问题 更多 >