EB CLI仅用作sudo;否则给出“ DistributionNotFound”

时间:2019-05-29 14:25:27

标签: amazon-web-services pip homebrew sudo ebcli

我运行eb --version时出现错误,并显示DistributionNotFound

(my-venv) MBP-2:folder username$ eb --version

回溯是:

    Traceback (most recent call last):
      File "/usr/local/bin/eb", line 5, in <module>
        from pkg_resources import load_entry_point
      File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2697, in <module>
      File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 669, in require
      File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 572, in resolve
    pkg_resources.DistributionNotFound: docker-py>=1.1.0,<1.2

看着this问题,我尝试了以下尝试,但无济于事:

  1. 更新的awsebcli:pip3 install awsebcli --upgrade
  2. 更新的设置工具:pip3 install setuptools --upgrade
  3. 更新的docker-py:pip3 install docker-py --upgrade

问题仍然存在。但是当我使用sudo时,它可以正常工作:

(my-venv) MBP-2:folder username$ sudo eb --version
EB CLI 3.15.2 (Python 3.6.1)

我认为这是由于耗时的自制软件自动更新引起的。我该如何解决?

修改:

这些是我的虚拟环境中的python版本。

(my-venv) MBP-2:folder username$ which python
/Users/username/my-venv/bin/python

(my-venv) MBP-2:folder username$ head -1 $(which eb)
#!/Users/username/my-venv/bin/python3

(my-venv) MBP-2:folder username$ head -1 $(which pip)
#!/Users/username/my-venv/bin/python3

(my-venv) MBP-2:folder username$ python --version
Python 3.6.1

(my-venv) MBP-2:folder username$ python3 --version
Python 3.6.1

1 个答案:

答案 0 :(得分:2)

据我所知,ebcli不依赖于docker-py,而是依赖于docker软件包。因此,这向我表明,安装软件包的导线可能会交叉。

我建议尝试的方法是重新创建此virtualenv,并且仅安装ebcli而不使用其他软件包。这样可以解决您所看到的错误。