【问题标题】:Installing Jupyter Notebook using pip in Ubuntu 14.04在 Ubuntu 14.04 中使用 pip 安装 Jupyter Notebook
【发布时间】:2018-05-02 14:22:06
【问题描述】:

我正在尝试安装jupyter notebook,但由于某些原因我无法安装它。我查看了几个链接,例如 thisthis,但它对我没有帮助。我猜这里的问题在于pip 的安装。当我检查pip 的版本时,我得到以下结果:

 shaloin@shaolin-Inspiron-3543:~$ pip --version
 pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)

但是当我尝试升级pip 的版本时,我收到了这个错误:

shaloin@shaolin-Inspiron-3543:~$ sudo pip install --upgrade pip
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pip in /usr/lib/python2.7/dist-packages
Downloading/unpacking pip
Cleaning up...
No distributions at all found for pip in /usr/lib/python2.7/dist-packages
Storing debug log for failure in /home/shaloin/.pip/pip.log

所以,我搜索了错误,我知道如果你在代理后面,你应该尝试以下命令:

sudo pip --proxy [NITS:abcde@]172.16.30.20:8080 install jupyter

其中NITS 是用户名abcde 是密码,proxy server = 172.16.30.20password=8080,之后出现以下错误:

Downloading/unpacking jupyter
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1178, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 194, in find_requirement
    page = self._get_page(main_index_url, req)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_page
    session=self.session,
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 670, in get_page
    resp = session.get(url, headers={"Accept": "text/html"})
  File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 467, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 237, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 455, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/sessions.py", line 558, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/adapters.py", line 305, in send
    conn = self.get_connection(request.url, proxies)
  File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/adapters.py", line 206, in get_connection
    except_on_missing_scheme(proxy)
  File "/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/utils.py", line 636, in except_on_missing_scheme
    raise MissingSchema('Proxy URLs must have explicit schemes.')
MissingSchema: Proxy URLs must have explicit schemes.

Storing debug log for failure in /home/shaloin/.pip/pip.log

我也尝试过以这种方式设置代理:

set http_proxy=http://username:password@proxyAddress:port

set https_proxy=https://username:password@proxyAddress:port

但这些都不适用于使用pip 安装jupyter notebook

请不要将此问题标记为重复,因为我一直在寻找解决方案,但没有一个有效。

有人可以帮忙吗?

【问题讨论】:

  • 您的pip 太旧,无法自行升级。试试get-pip.py
  • 我是新手,没有太多专业知识,所以我应该运行这个命令sudo pip get-pip.py
  • 没有。您需要下载该文件,然后将目录更改为该文件所在的位置,然后运行sudo python get-pip.py
  • 使用 Python 虚拟环境。使用 pip 将软件包安装/升级到系统 Python 是一个坏主意,因为您可能会破坏软件包的操作系统版本。

标签: python ubuntu pip jupyter-notebook


【解决方案1】:

适用于 Ubuntu 14.04

我使用anaconda解决了安装问题。描述在this链接中给出。我无法解决升级pip的问题。安装jupyter notebook的步骤如下:

第一步(参考here

首先我们使用wget安装anaconda

  • 32 位版本

wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86.sh

  • 64 位版本

wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86_64.sh

第 2 步

下载结束后:

  • 32 位版本

    bash Anaconda-2.3.0-Linux-x86.sh

  • 64 位版本

    bash Anaconda-2.3.0-Linux-x86_64.sh

下载anaconda后,打开你的terminal并输入以下命令:

$ sudo gedit ~/.profile

在文件末尾添加给定的行:

export PATH=~/anaconda2/bin:$PATH

第 3 步

添加行后保存文件。打开一个新的terminal 并进入下载anaconda 的目录。

$ cd anaconda2/bin
~/anaconda2/bin$ source activate
(root):~/anaconda2/bin$ jupyter notebook

jupyter notebook 将在浏览器中打开。

有关jupyter notebook的更多信息,您可以参考这个link

【讨论】:

    猜你喜欢
    • 2022-12-01
    • 1970-01-01
    • 2018-04-10
    • 2018-06-29
    • 1970-01-01
    • 2016-02-16
    • 2020-01-24
    • 1970-01-01
    相关资源
    最近更新 更多