python + pip安装bson错误

lot*_*cho 3 python pip bson

我想安装3rd库-> bson。但是接下来会出错,谁知道为什么呢?

# pip install bson
Collecting bson
  Using cached bson-0.5.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-cP7YdW/bson/setup.py", line 8, in <module>
        from pip import get_installed_distributions
    ImportError: cannot import name get_installed_distributions

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-cP7YdW/bson/
Run Code Online (Sandbox Code Playgroud)

系统信息:

# uname -a
Linux instance-says 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

python和pip版本信息?

# python -V
Python 2.7.13
# pip --version
pip 10.0.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
Run Code Online (Sandbox Code Playgroud)

phd*_*phd 5

pip多年来,作者一直警告不要这样做import pip。最终在版本10中,他们重组了代码。

要继续使用pip导入的软件包,pip您需要pip版本9:

python -m pip install -U 'pip>=9,<10'
Run Code Online (Sandbox Code Playgroud)

PS。已经有一个错误报告

  • @lotusecho 尝试 `sudo -H python -m pip install -U 'pip&gt;=9,&lt;10'` (2认同)