我想安装第 3 个库 -> 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/
系统信息:
# 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
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)
最佳答案
pip
作者多年来一直警告不要 import pip
.最后,在版本 10 中,他们重构了代码。
要继续将 pip
与导入 pip
的包一起使用,您需要 pip
版本 9:
python -m pip install -U 'pip>=9,<10'
附言。已经有一个bug report .
关于python+pip安装bson报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49854465/