我使用docker commend docker-compose build
和docker-compose up -d
yum install python-35 -y
并安装软件包并在docker-compose.yml中添加pip-3.5 install --upgrade pip
它会引发VersionConflict错误
You are using pip version 9.0.2, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
+ pip-3.5 install awscli
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 666, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 984, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 875, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 9.0.2 (/usr/local/lib/python3.5/site-packages), Requirement.parse('pip==9.0.1'))
During handling of the above exception, another exception occurred:
但我不知道为什么它需要pip == 9.0.1给我......
如何使用pip> = 9.0.2来解决问题?
添加
我的setup.py
install_requires = [
'nitro>=1.3.0,<1.4.0',
'mysqlclient',
'requests',
'beautifulsoup4',
'google-api-python-client',
'httplib2',
'raven',
]
当我在github上检查aws-cli/setup.py时
没有pip=9.0.1
当我改变pip-3.5 install awscli
时 - &gt; pip-3.5 install ipython
它有相同的错误
+ pip-3.5 install ipython
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 666, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 984, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 875, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 9.0.3 (/usr/local/lib/python3.5/site-packages), Requirement.parse('pip==9.0.1'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pip-3.5", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3144, in <module>
@_call_aside
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3128, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3157, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 668, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 681, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 870, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.1' distribution was not found and is required by the application
答案 0 :(得分:2)
通过python调用pip对我有用,例如:
python3 -m pip install --upgrade pip==9.0.1
(或您在Requirement.parse('pip==X.Y.Z')
中看到的任何版本)
答案 1 :(得分:1)
我解决了我的问题
pip-3.5 install --upgrade pip
和
pip install awscli
不是pip-3.5 install awscli
工作正常
答案 2 :(得分:0)
在Mac M1上,运行brew reinstall python
重新安装python即可解决。