如何为shell安装有道及更新pip.

Posted 神秘厉害人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何为shell安装有道及更新pip.相关的知识,希望对你有一定的参考价值。

今天尝试安装shell下的有道翻译,提示需要安装pip.

[[email protected] ~]# yum install python-pip
[[email protected] ~]# sudo pip install youdao 

 然而系统提示pip版本过期.

[[email protected] ~]# sudo pip install youdao
---------------------------------------- Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__=‘/tmp/pip-build-BZChCY/youdao/setup.py‘;exec(compile(getattr(tokenize, ‘open‘, open)(__file__).read().replace(‘\r\n‘, ‘\n‘), __file__, ‘exec‘))" install --record /tmp/pip-0GPHNf-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-BZChCY/youdao/ You are using pip version 8.1.2, however version 19.0.3 is available. You should consider upgrading via the ‘pip install --upgrade pip‘ command.

使用提示需要更新:
[[email protected] ~]# yum upgrade pip
You are using pip version 8.1.2, however version 19.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip‘ command.
[[email protected] ~]# pip install
You must give at least one requirement to install (see "pip help install")
You are using pip version 8.1.2, however version 19.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip‘ command.

更新命令:
[[email protected] ~] python -m pip install --upgrade pip 

检查后已经成功:
[[email protected] ~]# pip -V
pip 19.0.3 from /usr/lib/python2.7/site-packages/pip (python 2.7)
...待更

安装提示TLS/SSL错误:
_

 

 

[email protected] ~]# sudo pip install youdao
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting youdao
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError("Can‘t connect to HTTPS URL because the SSL module is not available.",)‘: /simple/youdao/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError("Can‘t connect to HTTPS URL because the SSL module is not available.",)‘: /simple/youdao/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError("Can‘t connect to HTTPS URL because the SSL module is not available.",)‘: /simple/youdao/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError("Can‘t connect to HTTPS URL because the SSL module is not available.",)‘: /simple/youdao/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError("Can‘t connect to HTTPS URL because the SSL module is not available.",)‘: /simple/youdao/
  Could not fetch URL https://pypi.org/simple/youdao/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org‘, port=443): Max retries exceeded with url: /simple/youdao/ (Caused by SSLError("Can‘t connect to HTTPS URL because the SSL module is not available.",)) - skipping
  Could not find a version that satisfies the requirement youdao (from versions: )
No matching distribution found for youdao

以上是关于如何为shell安装有道及更新pip.的主要内容,如果未能解决你的问题,请参考以下文章

如何为 XSLT 代码片段配置 CruiseControl 的 C# 版本?

如何为python安装子进程模块?

如何为新手安装pip

如何为指定python解释器安装pip

如何为 python 应用程序安装 Qt 模块

求助,在ubuntu 里如何为python添加库?