最近在Ubuntu14.04使用pip3安装软件包的时候出现了如下错误:TypeError: call() missing 1 required positional argument: ‘name’, 具体报错信息如下:
ziven@ziven-ubuntu-laptop ~ pip3 install --user cheat
Collecting cheat
Downloading cheat-2.2.0.tar.gz (63kB)
100% |████████████████████████████████| 71kB 385kB/s
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pip/basecommand.py",line 215,in main
status = self.run(options,args)
File "/usr/local/lib/python3.4/dist-packages/pip/commands/install.py",line 335,in run
wb.build(autobuilding=True)
File "/usr/local/lib/python3.4/dist-packages/pip/wheel.py",line 749,in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py",line 380,in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py",line 634,in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py",line 129,in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_install.py",line 412,in run_egg_info
self.setup_py,self.name,File "/usr/local/lib/python3.4/dist-packages/pip/req/req_install.py",line 387,in setup_py
import setuptools # noqa
File "/home/ziven/.local/lib/python3.4/site-packages/setuptools/__init__.py",line 12,in <module>
import setuptools.version
File "/home/ziven/.local/lib/python3.4/site-packages/setuptools/version.py",line 1,in <module>
import pkg_resources
File "/home/ziven/.local/lib/python3.4/site-packages/pkg_resources/__init__.py",line 72,in <module>
import packaging.requirements
File "/home/ziven/.local/lib/python3.4/site-packages/packaging/requirements.py",line 59,in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() missing 1 required positional argument: 'name'
网上搜索了一下类似的问题,发现主要原因是:pyparsing的版本过低(具体原因可以参考这里以及这里)。
所以解决方法就是升级本地的pyparsing的版本到>=2.0.2.
所以在我本地我做了如下升级:
pip3 install --user --upgrade pyparsing
之后再执行之前的安装就正常了:
ziven@ziven-ubuntu-laptop ~ pip3 install --user cheat
Collecting cheat
Using cached cheat-2.2.0.tar.gz
Collecting docopt>=0.6.1 (from cheat)
Downloading docopt-0.6.2.tar.gz
Requirement already satisfied: pygments>=1.6.0 in /usr/lib/python3/dist-packages (from cheat)
Building wheels for collected packages: cheat,docopt
Running setup.py bdist_wheel for cheat ... done
Stored in directory: /home/ziven/.cache/pip/wheels/bb/41/50/bff985ad8a9305bef57ff23efb93aedf92377c8f076c9ab151
Running setup.py bdist_wheel for docopt ... done
Stored in directory: /home/ziven/.cache/pip/wheels/b2/16/5f/c33a2bb5f2dce71205f8e65cbfd05647d79d441282be31fd82
Successfully built cheat docopt
Installing collected packages: docopt,cheat
Successfully installed cheat-2.2.0 docopt-0.6.2
原文链接:https://www.f2er.com/ubuntu/352914.html