我正在尝试在Windows 10上为python安装matplotlib,但似乎我尝试出现任何错误,我浏览了堆栈溢出并用Google搜索了该主题,但我似乎找不到答案,有人可以指出我朝着正确的方向前进?
我尝试过标准:
pip install matplotlib
在CMD终端中,但出现此错误代码:
Using cached https://files.pythonhosted.org/packages/12/d1/7b12cd79c791348cb0c78ce6e7d16bd72992f13c9f1e8e43d2725a6d8adf/matplotlib-3.1.1.tar.gz
Requirement already satisfied: cycler>=0.10 in c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib) (2.8.0)
Requirement already satisfied: numpy>=1.11 in c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib) (1.17.3)
Requirement already satisfied: six in c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages (from cycler>=0.10->matplotlib) (1.12.0)
Requirement already satisfied: setuptools in c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (41.6.0)
Building wheels for collected packages: matplotlib
Building wheel for matplotlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\domin\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\domin\\AppData\\Local\\Temp\\pip-install-k94h6hjh\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\domin\\AppData\\Local\\Temp\\pip-install-k94h6hjh\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\domin\AppData\Local\Temp\pip-wheel-hcekg12l' --python-tag cp38
cwd: C:\Users\domin\AppData\Local\Temp\pip-install-k94h6hjh\matplotlib\
Complete output (547 lines):
================================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [3.1.1]
python: yes [3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC
v.1916 32 bit (Intel)]]
platform: yes [win32]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
tests: no [skipping due to configuration]
OPTIONAL BACKEND EXTENSIONS
agg: yes [installing]
tkagg: yes [installing; run-time loading from Python Tcl/Tk]
macosx: no [Mac OS-X only]
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.8
copying lib\pylab.py -> build\lib.win32-3.8
creating build\lib.win32-3.8\matplotlib
copying lib\matplotlib\afm.py -> build\lib.win32-3.8\matplotlib
copying lib\matplotlib\animation.py -> build\lib.win32-3.8\matplotlib
...
...
...
copying lib\matplotlib\mpl-data\sample_data\s1045.ima.gz -> build\lib.win32-3.8\matplotlib\mpl-data\sample_data
copying lib\matplotlib\mpl-data\sample_data\README.txt -> build\lib.win32-3.8\matplotlib\mpl-data\sample_data
UPDATING build\lib.win32-3.8\matplotlib\_version.py
set build\lib.win32-3.8\matplotlib\_version.py to '3.1.1'
running build_ext
building 'matplotlib.ft2font' extension
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\domin\AppData\Local\Temp\pip-install-k94h6hjh\matplotlib\setup.py", line 262, in <module>
setup(
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
_build_ext.run(self)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\Users\domin\AppData\Local\Temp\pip-install-k94h6hjh\matplotlib\setup.py", line 118, in build_extensions
return super().build_extensions()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\build_ext.py", line 205, in build_extension
_build_ext.build_extension(self, ext)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 171, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 1620, in return_env
if self.vs_ver >= 14 and isfile(self.VCRuntimeRedist):
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\genericpath.py", line 30, in isfile
st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
----------------------------------------
ERROR: Failed building wheel for matplotlib
Running setup.py clean for matplotlib
Failed to build matplotlib
Installing collected packages: matplotlib
Running setup.py install for matplotlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\domin\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\domin\\AppData\\Local\\Temp\\pip-install-k94h6hjh\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\domin\\AppData\\Local\\Temp\\pip-install-k94h6hjh\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\domin\AppData\Local\Temp\pip-record-f0_7ypbd\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\domin\AppData\Local\Temp\pip-install-k94h6hjh\matplotlib\
Complete output (549 lines):
================================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [3.1.1]
python: yes [3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC
v.1916 32 bit (Intel)]]
platform: yes [win32]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
tests: no [skipping due to configuration]
OPTIONAL BACKEND EXTENSIONS
agg: yes [installing]
tkagg: yes [installing; run-time loading from Python Tcl/Tk]
macosx: no [Mac OS-X only]
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
copying lib\pylab.py -> build\lib.win32-3.8
creating build\lib.win32-3.8\matplotlib
copying lib\matplotlib\afm.py -> build\lib.win32-3.8\matplotlib
...
...
...
copying lib\matplotlib\backends\web_backend\css\page.css -> build\lib.win32-3.8\matplotlib\backends\web_backend\css
copying lib\matplotlib\mpl-data\fonts\ttf\DejaVuSerif-BoldItalic.ttf -> build\lib.win32-3.8\matplotlib\mpl-data\fonts\ttf
copying lib\matplotlib\mpl-data\fonts\afm\pagk8a.afm -> build\lib.win32-3.8\matplotlib\mpl-data\fonts\afm
copying lib\matplotlib\mpl-data\images\home_large.gif -> build\lib.win32-3.8\matplotlib\mpl-data\images
UPDATING build\lib.win32-3.8\matplotlib\_version.py
set build\lib.win32-3.8\matplotlib\_version.py to '3.1.1'
running build_ext
building 'matplotlib.ft2font' extension
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\domin\AppData\Local\Temp\pip-install-k94h6hjh\matplotlib\setup.py", line 262, in <module>
setup(
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
_build_ext.run(self)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\Users\domin\AppData\Local\Temp\pip-install-k94h6hjh\matplotlib\setup.py", line 118, in build_extensions
return super().build_extensions()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\build_ext.py", line 205, in build_extension
_build_ext.build_extension(self, ext)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\command\build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 171, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 1620, in return_env
if self.vs_ver >= 14 and isfile(self.VCRuntimeRedist):
File "c:\users\domin\appdata\local\programs\python\python38-32\lib\genericpath.py", line 30, in isfile
st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\domin\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\domin\\AppData\\Local\\Temp\\pip-install-k94h6hjh\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\domin\\AppData\\Local\\Temp\\pip-install-k94h6hjh\\matplotlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\domin\AppData\Local\Temp\pip-record-f0_7ypbd\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
我也尝试了以下命令(在答案论坛中找到):
python -m pip install matplotlib
pip3 install matplotlib
easy_install -m matplotlib
py -3 -m pip install --user matplotlib
在此先感谢您的帮助! :D
多米尼克。