pip install时报错TypeError: __call__() missing 1 required positional argument: 'name'解决

前端之家收集整理的这篇文章主要介绍了pip install时报错TypeError: __call__() missing 1 required positional argument: 'name'解决前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

最近在Ubuntu14.04使用pip3安装软件包的时候出现了如下错误:TypeError: call() missing 1 required positional argument: ‘name’, 具体报错信息如下:

  1. ziven@ziven-ubuntu-laptop ~ pip3 install --user cheat
  2. Collecting cheat
  3. Downloading cheat-2.2.0.tar.gz (63kB)
  4. 100% |████████████████████████████████| 71kB 385kB/s
  5. Exception:
  6. Traceback (most recent call last):
  7. File "/usr/local/lib/python3.4/dist-packages/pip/basecommand.py",line 215,in main
  8. status = self.run(options,args)
  9. File "/usr/local/lib/python3.4/dist-packages/pip/commands/install.py",line 335,in run
  10. wb.build(autobuilding=True)
  11. File "/usr/local/lib/python3.4/dist-packages/pip/wheel.py",line 749,in build
  12. self.requirement_set.prepare_files(self.finder)
  13. File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py",line 380,in prepare_files
  14. ignore_dependencies=self.ignore_dependencies))
  15. File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py",line 634,in _prepare_file
  16. abstract_dist.prep_for_dist()
  17. File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py",line 129,in prep_for_dist
  18. self.req_to_install.run_egg_info()
  19. File "/usr/local/lib/python3.4/dist-packages/pip/req/req_install.py",line 412,in run_egg_info
  20. self.setup_py,self.name,File "/usr/local/lib/python3.4/dist-packages/pip/req/req_install.py",line 387,in setup_py
  21. import setuptools # noqa
  22. File "/home/ziven/.local/lib/python3.4/site-packages/setuptools/__init__.py",line 12,in <module>
  23. import setuptools.version
  24. File "/home/ziven/.local/lib/python3.4/site-packages/setuptools/version.py",line 1,in <module>
  25. import pkg_resources
  26. File "/home/ziven/.local/lib/python3.4/site-packages/pkg_resources/__init__.py",line 72,in <module>
  27. import packaging.requirements
  28. File "/home/ziven/.local/lib/python3.4/site-packages/packaging/requirements.py",line 59,in <module>
  29. MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
  30. TypeError: __call__() missing 1 required positional argument: 'name'

网上搜索了一下类似的问题,发现主要原因是:pyparsing的版本过低(具体原因可以参考这里以及这里)。
所以解决方法就是升级本地的pyparsing的版本到>=2.0.2.
所以在我本地我做了如下升级:

  1. pip3 install --user --upgrade pyparsing

之后再执行之前的安装就正常了:

  1. ziven@ziven-ubuntu-laptop ~ pip3 install --user cheat
  2. Collecting cheat
  3. Using cached cheat-2.2.0.tar.gz
  4. Collecting docopt>=0.6.1 (from cheat)
  5. Downloading docopt-0.6.2.tar.gz
  6. Requirement already satisfied: pygments>=1.6.0 in /usr/lib/python3/dist-packages (from cheat)
  7. Building wheels for collected packages: cheat,docopt
  8. Running setup.py bdist_wheel for cheat ... done
  9. Stored in directory: /home/ziven/.cache/pip/wheels/bb/41/50/bff985ad8a9305bef57ff23efb93aedf92377c8f076c9ab151
  10. Running setup.py bdist_wheel for docopt ... done
  11. Stored in directory: /home/ziven/.cache/pip/wheels/b2/16/5f/c33a2bb5f2dce71205f8e65cbfd05647d79d441282be31fd82
  12. Successfully built cheat docopt
  13. Installing collected packages: docopt,cheat
  14. Successfully installed cheat-2.2.0 docopt-0.6.2

猜你在找的Ubuntu相关文章