使用pip安装时出错

时间:2017-07-24 17:25:48

标签: python python-2.7 pip

我正在尝试使用pip安装Chatterbot,但会收到以下错误。

  

命令" python setup.py egg_info"失败,错误代码为1   /private/var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/pip-build-8wG6yW/ruamel.yaml /

完整日志如下

➜  Documents pip install ./ChatterBot
Processing ./ChatterBot
Collecting chatterbot-corpus<1.1,>=1.0 (from ChatterBot==0.7.3)
  Using cached chatterbot_corpus-1.0.0-py2.py3-none-any.whl
Collecting jsondatabase<1.0.0,>=0.1.7 (from ChatterBot==0.7.3)
  Using cached jsondatabase-0.1.7-py2.py3-none-any.whl
Collecting nltk<4.0,>=3.2 (from ChatterBot==0.7.3)
  Using cached nltk-3.2.4.tar.gz
Collecting pymongo<4.0,>=3.3 (from ChatterBot==0.7.3)
  Using cached pymongo-3.4.0-cp27-cp27m-macosx_10_12_intel.whl
Collecting python-dateutil<2.7,>=2.6 (from ChatterBot==0.7.3)
  Using cached python_dateutil-2.6.1-py2.py3-none-any.whl
Collecting python-twitter<4.0,>=3.0 (from ChatterBot==0.7.3)
  Using cached python_twitter-3.3-py2-none-any.whl
Collecting sqlalchemy<1.2,>=1.1 (from ChatterBot==0.7.3)
  Using cached SQLAlchemy-1.1.11.tar.gz
Collecting ruamel.yaml<=0.15 (from chatterbot-corpus<1.1,>=1.0->ChatterBot==0.7.3)
  Using cached ruamel.yaml-0.15.0.tar.gz
    Complete output from command python setup.py egg_info:
    /var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/tmp_ruamel_H5mSkZ/test_ruamel_yaml.c:6:8: warning: explicitly assigning value of variable of type 'yaml_parser_t' (aka 'struct yaml_parser_s') to itself [-Wself-assign]
    parser = parser;  /* prevent warning */
    ~~~~~~ ^ ~~~~~~
    /var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/tmp_ruamel_H5mSkZ/test_ruamel_yaml.c:6:10: warning: variable 'parser' is uninitialized when used here [-Wuninitialized]
    parser = parser;  /* prevent warning */
             ^~~~~~
    /var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/tmp_ruamel_H5mSkZ/test_ruamel_yaml.c:5:1: note: variable 'parser' is declared here
    yaml_parser_t parser;
    ^
    2 warnings generated.
    /var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/tmp_ruamel_H5mSkZ/test_ruamel_yaml.c:6:8: warning: explicitly assigning value of variable of type 'yaml_parser_t' (aka 'struct yaml_parser_s') to itself [-Wself-assign]
    parser = parser;  /* prevent warning */
    ~~~~~~ ^ ~~~~~~
    /var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/tmp_ruamel_H5mSkZ/test_ruamel_yaml.c:6:10: warning: variable 'parser' is uninitialized when used here [-Wuninitialized]
    parser = parser;  /* prevent warning */
             ^~~~~~
    /var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/tmp_ruamel_H5mSkZ/test_ruamel_yaml.c:5:1: note: variable 'parser' is declared here
    yaml_parser_t parser;
    ^
    2 warnings generated.
    sys.argv ['-c', 'egg_info', '--egg-base', 'pip-egg-info']
    test compiling test_ruamel_yaml
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/pip-build-8wG6yW/ruamel.yaml/setup.py", line 858, in <module>
        main()
      File "/private/var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/pip-build-8wG6yW/ruamel.yaml/setup.py", line 847, in main
        setup(**kw)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 272, in __init__
        _Distribution.__init__(self,attrs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 326, in finalize_options
        ep.require(installer=self.fetch_build_egg)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2385, in require
        reqs = self.dist.requires(self.extras)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2617, in requires
        dm = self._dep_map
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2606, in _dep_map
        if invalid_marker(marker):
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1424, in is_invalid_marker
        cls.evaluate_marker(text)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1549, in _markerlib_evaluate
        env = cls._translate_metadata2(_markerlib.default_environment())
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1537, in _translate_metadata2
        for key, value in env
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1536, in <genexpr>
        (key.replace('.', '_'), value)
    ValueError: too many values to unpack

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/nw/vxggqrcx463g3f3zxp71dc5r0000gn/T/pip-build-8wG6yW/ruamel.yaml/

我的pip安装已经是最新版本。我甚至尝试按照其他网站上的建议重新安装它,但无法使其正常工作。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:3)

安装setuptools后命令工作。

pip install -U pip setuptools --user python 

我之前也尝试过但没有--user python。它失败然后在追加用户之后工作。