繁体   English   中英

"pip install matplotlib":""python setup.py egg_info" failed with error code 1" 安装 matplotlib 时

[英]"pip install matplotlib":"“python setup.py egg_info” failed with error code 1" while installing matplotlib

我是python的新手。 在命令提示符下安装matplotlib时,它抛出以下错误

使用的命令: pip install matplotlib

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Prasanth\AppData\Local\Temp\pip-install-4wpq_qdh\matplotlib\

下面附上命令提示符的屏幕截图。 有人可以请教如何解决这个问题吗?

C:\Users\Prasanth>pip install matplotlib
Collecting matplotlib
  Using cached https://files.pythonhosted.org/packages/be/06/81367951cc50695830482eacefdc8289c68770db166a4d4283e7eac22dee/matplotlib-3.2.0.tar.gz
    Complete output from command python setup.py egg_info:
    WARNING: The wheel package is not available.
    Command "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\Scripts\python.exe C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_vendor\pep517\_in_process.py prepare_metadata_for_build_wheel C:\Users\Prasanth\AppData\Local\Temp\tmpauafujib" failed with error code 1 in C:\Users\Prasanth\AppData\Local\Temp\pip-wheel-ybn9_t9v\numpy
    Traceback (most recent call last):
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
      File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['C:\\Users\\Prasanth\\PycharmProjects\\Classess_Test\\venv\\Scripts\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\Prasanth\\AppData\\Local\\Temp\\tmp482ludrm', '--quiet', 'numpy>=1.11']' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Prasanth\AppData\Local\Temp\pip-install-4wpq_qdh\matplotlib\setup.py", line 232, in <module>
        setup(
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\setuptools\__init__.py", line 143, in setup
        _install_setup_requires(attrs)
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\setuptools\__init__.py", line 138, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\setuptools\dist.py", line 684, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\pkg_resources\__init__.py", line 781, in resolve
        dist = best[req.key] = env.best_match(
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\pkg_resources\__init__.py", line 1066, in best_match
        return self.obtain(req, installer)
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\pkg_resources\__init__.py", line 1078, in obtain
        return installer(requirement)
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\setuptools\dist.py", line 743, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "C:\Users\Prasanth\PycharmProjects\Classess_Test\venv\lib\site-packages\setuptools\installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['C:\\Users\\Prasanth\\PycharmProjects\\Classess_Test\\venv\\Scripts\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\Prasanth\\AppData\\Local\\Temp\\tmp482ludrm', '--quiet', 'numpy>=1.11']' returned non-zero exit status 1.

    Edit setup.cfg to change the build options; suppress output with --quiet.

    BUILDING MATPLOTLIB
      matplotlib: yes [3.2.0]
          python: yes [3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC
                      v.1916 32 bit (Intel)]]
        platform: yes [win32]
     sample_data: yes [installing]
           tests: no  [skipping due to configuration]
             agg: yes [installing]
           tkagg: yes [installing; run-time loading from Python Tcl/Tk]
          macosx: no  [Mac OS-X only]


    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Prasanth\AppData\Local\Temp\pip-install-4wpq_qdh\matplotlib\

截屏

大多数情况下,这个问题是由于旧版本的 setuptools。 所以你可以用下面的代码升级它:

pip install --upgrade setuptools

并尝试以管理员身份打开您的 CMD。

您也可以通过 Conda 简单地安装您的软件包。 您只需要运行以下其中一项:

conda install -c conda-forge matplotlib
conda install -c conda-forge/label/testing matplotlib
conda install -c conda-forge/label/testing/gcc7 matplotlib
conda install -c conda-forge/label/matplotlib_rc matplotlib
conda install -c conda-forge/label/gcc7 matplotlib
conda install -c conda-forge/label/broken matplotlib
conda install -c conda-forge/label/rc matplotlib
conda install -c conda-forge/label/cf201901 matplotlib
conda install -c conda-forge/label/broken-test matplotlib

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM