使用pip install,pip list等时出现不同的错误消息

问题描述 投票:1回答:1

当我尝试做pip uninstall scikit-learn时,我试图解决另一个问题在做完之后我收到了红色文本,例如:

pip install --upgrade pip
    Error checking for conflicts.
    Traceback (most recent call last):
          File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
        pip\_vendor\pkg_resources\__init__.py", line 2584, in version
            return self._version
          File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
        pip\_vendor\pkg_resources\__init__.py", line 2691, in __getattr__
            raise AttributeError(attr)
        AttributeError: _version

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_internal\commands\install.py", line 503, in _warn_about_conflicts
        package_set, _dep_info = check_install_conflicts(to_install)
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_internal\operations\check.py", line 108, in check_install_conflicts
        package_set, _ = create_package_set_from_installed()
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_internal\operations\check.py", line 47, in create_package_set_from_installe
    d
        package_set[name] = PackageDetails(dist.version, dist.requires())
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_vendor\pkg_resources\__init__.py", line 2589, in version
        raise ValueError(tmpl % self.PKG_INFO, self)
    ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown
    version] (c:\users\james\appdata\local\programs\python\python37\lib\site-package
    s))



C:\Users\James>pip list
    Exception:
    Traceback (most recent call last):
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_vendor\pkg_resources\__init__.py", line 2584, in version
        return self._version
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_vendor\pkg_resources\__init__.py", line 2691, in __getattr__
        raise AttributeError(attr)
    AttributeError: _version

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_internal\cli\base_command.py", line 176, in main
        status = self.run(options, args)
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_internal\commands\list.py", line 148, in run
        self.output_package_listing(packages, options)
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_internal\commands\list.py", line 205, in output_package_listing
        data, header = format_for_columns(packages, options)
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_internal\commands\list.py", line 271, in format_for_columns
        row = [proj.project_name, proj.version]
      File "c:\users\james\appdata\local\programs\python\python37\lib\site-packages\
    pip\_vendor\pkg_resources\__init__.py", line 2589, in version
        raise ValueError(tmpl % self.PKG_INFO, self)
    ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown
    version] (c:\users\james\appdata\local\programs\python\python37\lib\site-package
    s))

关于如何解决此问题的任何建议(Windows)。我甚至不知道该搜索什么错误。任何建议都是祝福!

python scikit-learn pip
1个回答
8
投票

this Issue on the pip GitHub repository解决了类似的问题。

你的案例中的建议是进入

c:\users\james\appdata\local\programs\python\python37\lib\site-packages

并且,对于以“ - ”开头的每个文件夹,删除它并重新安装相应的包。

© www.soinside.com 2019 - 2024. All rights reserved.