【发布时间】:2016-12-05 18:25:41
【问题描述】:
我正在使用 python2.7 virtualenv(版本 15.0.1)在 Ubuntu 16.04 上工作。 当我创建一个新的 virtualenv 时,它会自动安装 pip(版本 8.1.1)。 我想将 pip 降级到 8.0.2 版本,但是在运行时
pip install pip==8.0.2
我收到以下错误:
Exception:
Traceback (most recent call last):
File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/commands/install.py", line 328, in run
wb.build(autobuilding=True)
File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_set.py", line 448, in _prepare_file
req_to_install, finder)
File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_set.py", line 387, in _check_skip_installed
req_to_install.check_if_exists()
File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1011, in check_if_exists
self.req.project_name
AttributeError: 'Requirement' object has no attribute 'project_name'
但是,在 virtualenv 之外运行它是可行的。
有人知道这个问题的解决方法吗?
之所以要降级pip版本是因为新版本在搜索包的时候会将点(.)转换成破折号(-),并且没有找到我需要的一些包。
【问题讨论】:
标签: python python-2.7 virtualenv