2017-07-25 146 views
1

我正在使用this Ansible-Django堆栈将我的Django项目部署到AWS EC2实例。它很好地运行了很长时间,但现在突然间,部署时出现以下错误。Pip正在回退卸载setuptools

看起来好像有一个新的setuptools构建未正确更新。

  • 它为什么会回滚卸载setuptools
  • 为什么不安装setuptools 36.2.2?

明确指定在我的要求的setuptools版本解决了这个问题,但由于我只对setuptools间接相关的,它不应该是我的责任,知道要保留哪个版本。

Installing collected packages: shared-django, setuptools 
    Found existing installation: shared-django 0.1.0 
    Uninstalling shared-django-0.1.0: 
     Successfully uninstalled shared-django-0.1.0 
    Running setup.py install for shared-django: started 
    Running setup.py install for shared-django: finished with status 'done' 
    Found existing installation: setuptools 36.2.0 
    Uninstalling setuptools-36.2.0: 
     Successfully uninstalled setuptools-36.2.0 
    Rolling back uninstall of setuptools 

:stderr: Exception: 
Traceback (most recent call last): 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/basecommand.py\", line 215, in main 
    status = self.run(options, args) 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/commands/install.py\", line 342, in run 
    prefix=options.prefix_path, 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/req/req_set.py\", line 784, in install 
    **kwargs 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/req/req_install.py\", line 851, in install 
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/req/req_install.py\", line 1064, in move_wheel_files 
    isolated=self.isolated, 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/wheel.py\", line 247, in move_wheel_files 
    prefix=prefix, 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/pip/locations.py\", line 140, in distutils_scheme 
    d = Distribution(dist_args) 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/setuptools/dist.py\", line 365, in __init__ 
    self._finalize_requires() 
    File \"/webapps/CatalogService/lib/python3.5/site-packages/setuptools/dist.py\", line 372, in _finalize_requires 
    if not self.install_requires: 
AttributeError: 'Distribution' object has no attribute 'install_requires' 

回答

1

我不得不ssh到服务器并运行

python -m pip install --upgrade -vv setuptools

,然后我再部署和它的工作。