错误:在安装Matplotlib时,退出状态为1的命令出错

2024-09-29 06:34:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试运行我大学时的一些旧python脚本,但要做到这一点,我需要重新安装python和PyCharm

在运行第一个脚本时,它说我需要安装tablate,我是通过使用:

pip3 install tabulate

这似乎起到了作用,当我现在运行旧脚本时,它说我需要安装matplotlib,我尝试使用以下命令:

pip3 install matplotlib

这样做效果不太好,反而抛出了一条错误消息:

     command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr
         cwd: /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/
    Complete output (64 lines):
    WARNING: The wheel package is not available.
    WARNING: The wheel package is not available.
    
    Edit setup.cfg to change the build options; suppress output with --quiet.
    
    BUILDING MATPLOTLIB
      matplotlib: yes [3.3.2]
          python: yes [3.9.0 (v3.9.0:9cf6752276, Oct  5 2020, 11:29:23)  [Clang 6.0
                      (clang-600.0.57)]]
        platform: yes [darwin]
     sample_data: yes [installing]
           tests: no  [skipping due to configuration]
          macosx: yes [installing]
    
    running egg_info
    creating /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr/matplotlib.egg-info
    writing /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr/matplotlib.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr/matplotlib.egg-info/dependency_links.txt
    writing namespace_packages to /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr/matplotlib.egg-info/namespace_packages.txt
    writing requirements to /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr/matplotlib.egg-info/requires.txt
    writing top-level names to /private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr/matplotlib.egg-info/top_level.txt
    writing manifest file '/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-pip-egg-info-2iy2j8sr/matplotlib.egg-info/SOURCES.txt'
    init_dgelsd failed init
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/setup.py", line 242, in <module>
        setup(  # Finally, pass this all along to distutils to do the heavy lifting.
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 297, in run
        self.find_sources()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 304, in find_sources
        mm.run()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 535, in run
        self.add_defaults()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 571, in add_defaults
        sdist.add_defaults(self)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/setup.py", line 88, in finalize_options
        self.distribution.ext_modules[:] = [
      File "/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/setup.py", line 91, in <listcomp>
        for ext in package.get_extensions()
      File "/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/setupext.py", line 345, in get_extensions
        add_numpy_flags(ext)
      File "/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/setupext.py", line 469, in add_numpy_flags
        import numpy as np
      File "/private/var/folders/wh/h7r4t3b57fgfm1zlcld1jh7w0000gn/T/pip-install-y9zq8j0t/matplotlib/.eggs/numpy-1.19.2-py3.9-macosx-10.9-x86_64.egg/numpy/__init__.py", line 286, in <module>
        raise RuntimeError(msg)
    RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
    RankWarning: Polyfit may be poorly conditioned
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.```

Any advice on how to fix this will be really appreciated. I just want to run my old programmes!

Tags: pipinpyinfomatplotlibeggvarline