在Ubuntu 14.04中使用pip安装Jupyter Notebook

时间:2017-11-19 04:58:45

标签: python ubuntu pip jupyter-notebook

我正在尝试安装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

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

请不要将此问题标记为重复,因为我一直在寻找解决方案,但这些问题都不起作用。

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

适用于Ubuntu 14.04

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

第1步(请参阅here

首先,我们使用anaconda

安装wget
  • 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