pip正确安装方法简记

Rhilip 2017-06-14 PM 1736℃ 0条

今天在给发种姬搬家的时候发现了一个很奇怪的问题。。
在安转flexget时候提示

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 290, 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 1266, in prepare_files
req_to_install.extras):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2401, in requires
dm = self._dep_map
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2597, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2621, in _compute_dependencies
parsed = next(parse_requirements(distvers))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 49, in <lambda>
next = lambda o: o.next()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2721, in parse_requirements
"version spec")
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2686, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', 'requests ~=2.16.3', 'at', ' ~=2.16.3')
Storing debug log for failure in /root/.pip/pip.log

并且使用pip install -U pip和pip install -U requests均没能解决问题。

分别提示pip已经是最新的版本,在升级requests时候则提示
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
仔细回看了一下前面使用apt-get安装pip时候的时候,系统自动把低版本的requests给装上了(这里甚是奇怪。以前都没有出现过这种问题,估计是使用的源的问题。)

那么原来在配置Autoseed时候安装flexget的过程前安装pip(py2)就不能那么写了。。参照官方的安装方法。要改成这样的

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

如果已经使用apt-get安装了pip,要卸载使用正确的方法安装,则应该

apt-get remove python-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
hash -r

以上参见:

  1. Installing with get-pip.py
  2. /usr/bin/pip: No such file or directory
标签: Autoseed, pip, flexget

非特殊说明,本博所有文章均为博主原创。

评论啦~