当我做pip –version它显示错误为ImportError:没有名为pyparsing的模块

我尝试安装/卸载pyparsing以及它不起作用。 我坚持这一点,我也必须安装额外的库。

这是错误消息:

Traceback (most recent call last): File "/usr/bin/pip", line 5, in <module> from pkg_resources import load_entry_point File "/home/rachana/.local/lib/python2.7/site-packages/pkg_resour‌​ces/__init__.py", line 72, in <module> import packaging.requirements File "/home/rachana/.local/lib/python2.7/site-packages/packaging/‌​requirements.py", line 9, in <module> from pyparsing import stringStart, stringEnd, originalTextFor, ParseException ImportError: No module named pyparsing 

我怎样才能解决这个问题?

Solutions Collecting From Web of "当我做pip –version它显示错误为ImportError:没有名为pyparsing的模块"

我有同样的问题,并解决它。 在这里你可以看到,点不能正常工作(没有任何额外的参数)。

 root@notebook:/home/ci# pip Traceback (most recent call last): File "/usr/bin/pip", line 5, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 72, in <module> import packaging.requirements File "/usr/local/lib/python2.7/dist-packages/packaging/requirements.py", line 9, in <module> from pyparsing import stringStart, stringEnd, originalTextFor, ParseException 

好,首先我们可以做的是安装破碎的依赖关系:

 wget https://pypi.python.org/packages/3c/ec/a94f8cf7274ea60b5413df054f82a8980523efd712ec55a59e7c3357cf7c/pyparsing-2.2.0.tar.gz gunzip pyparsing-2.2.0.tar.gz tar -xvf pyparsing-2.2.0.tar cd pyparsing-2.2.0 && python setup.py install 

之后,依赖将从源安装。

试图再次使用点子:

 root@rundeck.euovh01.un.private:/tmp/pyparsing-2.2.0# pip Traceback (most recent call last): File "/usr/bin/pip", line 5, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 74, in <module> import appdirs ImportError: No module named appdirs 

这是下一个问题。 你可以更快地修复它:

 root@notebook:/home/ci# python -m pip install appdirs Downloading/unpacking appdirs Downloading appdirs-1.4.3-py2.py3-none-any.whl Installing collected packages: appdirs Successfully installed appdirs Cleaning up... 

之后,我的点成功修复。 亲切的问候。

类似于@Oleg Mykolaichenko答案 ,但使用点子:

 [sudo] pip install pyparsing [sudo] pip install appdirs