当我想安装protobuf时,我输入了命令:pip install -V protobuf==3.0.0a2
,然后我收到以下结果:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==8.1.1', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.7/dist-packages/setuptools-5.7-py2.7.egg/pkg_resources.py", line 356, in load_entry_point
File "/usr/local/lib/python2.7/dist-packages/setuptools-5.7-py2.7.egg/pkg_resources.py", line 2472, in load_entry_point
File "/usr/local/lib/python2.7/dist-packages/setuptools-5.7-py2.7.egg/pkg_resources.py", line 2186, in load
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 18, in <module>
from pip.commands import get_summaries, get_similar_commands
File "/usr/lib/python2.7/dist-packages/pip/commands/__init__.py", line 8, in <module>
from pip.commands.freeze import FreezeCommand
File "/usr/lib/python2.7/dist-packages/pip/commands/freeze.py", line 8, in <module>
from pip.operations.freeze import freeze
File "/usr/lib/python2.7/dist-packages/pip/operations/freeze.py", line 11, in <module>
from pip._vendor.pkg_resources import RequirementParseError
ImportError: cannot import name RequirementParseError
有人知道如何解决吗?
答案1
你做错了。
pip
从......中去除在/usr/本地/binpip
从官方存储库安装(sudo apt-get install python-pip
)- 然后使用以下方式安装 protobuf
sudo pip install -V protobuf==3.0.0a2
采取这些措施后,我protobuf 3.0.0a2安装到/usr/local/lib/python2.7/dist-packages。
请记住规则:如果你需要某些软件,请尝试找到它的包然后使用 apt-get 安装。它不像 Windows 那样有 EXE、MSI 和 MSP。从第三方软件包安装软件或从源代码编译软件会导致系统混乱,并使管理和使用更加困难。