【发布时间】:2018-05-02 14:22:06
【问题描述】:
我正在尝试安装jupyter notebook,但由于某些原因我无法安装它。我查看了几个链接,例如 this 和 this,但它对我没有帮助。我猜这里的问题在于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.20 和password=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