赞
踩
1、在通过python2 -m pip install matplotlib=2.2.4时出现以下错误:
- DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
- Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
- Collecting matplotlib==2.1.0
- Downloading http://mirrors.aliyun.com/pypi/packages/89/b2/41ae0d5922a8018c1f506ef9b9363fca60326c8b24241b13ecaf80fede47/matplotlib-2.1.0-cp27-cp27mu-manylinux1_x86_64.whl (14.9MB)
- |████████████████████████████████| 14.9MB 10.6MB/s
- Collecting subprocess32
- Downloading http://mirrors.aliyun.com/pypi/packages/32/c8/564be4d12629b912ea431f1a50eb8b3b9d00f1a0b1ceff17f266be190007/subprocess32-3.5.4.tar.gz (97kB)
- |████████████████████████████████| 102kB 14.0MB/s
- Collecting cycler>=0.10
- Downloading http://mirrors.aliyun.com/pypi/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
- Requirement already satisfied: six>=1.10 in /usr/lib/python2.7/site-packages (from matplotlib==2.1.0) (1.12.0)
- Collecting backports.functools-lru-cache
- Downloading http://mirrors.aliyun.com/pypi/packages/03/8e/2424c0e65c4a066e28f539364deee49b6451f8fcd4f718fefa50cc3dcf48/backports.functools_lru_cache-1.5-py2.py3-none-any.whl
- Requirement already satisfied: pytz in /usr/lib/python2.7/site-packages (from matplotlib==2.1.0) (2016.10)
- Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1
- Downloading http://mirrors.aliyun.com/pypi/packages/11/fa/0160cd525c62d7abd076a070ff02b2b94de589f1a9789774f17d7c54058e/pyparsing-2.4.2-py2.py3-none-any.whl (65kB)
- |████████████████████████████████| 71kB 11.7MB/s
- Requirement already satisfied: numpy>=1.7.1 in /usr/lib64/python2.7/site-packages (from matplotlib==2.1.0) (1.16.5)
- Requirement already satisfied: python-dateutil>=2.0 in /usr/lib/python2.7/site-packages (from matplotlib==2.1.0) (2.8.0)
- Installing collected packages: subprocess32, cycler, backports.functools-lru-cache, pyparsing, matplotlib
- Running setup.py install for subprocess32 ... error
- ERROR: Command errored out with exit status 1:
- command: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ueq7J2/subprocess32/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ueq7J2/subprocess32/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-sOTfk8/install-record.txt --single-version-externally-managed --compile
- cwd: /tmp/pip-install-ueq7J2/subprocess32/
- Complete output (62 lines):
- /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
- warnings.warn(msg)
- running install
- running build
- running build_py
- creating build
- creating build/lib.linux-x86_64-2.7
- copying subprocess32.py -> build/lib.linux-x86_64-2.7
- running build_ext
- running build_configure
- checking for gcc... gcc
- checking whether the C compiler works... yes
- checking for C compiler default output file name... a.out
- checking for suffix of executables...
- checking whether we are cross compiling... no
- checking for suffix of object files... o
- checking whether we are using the GNU C compiler... yes
- checking whether gcc accepts -g... yes
- checking for gcc option to accept ISO C89... none needed
- checking how to run the C preprocessor... gcc -E
- checking for grep that handles long lines and -e... /usr/bin/grep
- checking for egrep... /usr/bin/grep -E
- checking for ANSI C header files... yes
- checking for sys/types.h... yes
- checking for sys/stat.h... yes
- checking for stdlib.h... yes
- checking for string.h... yes
- checking for memory.h... yes
- checking for strings.h... yes
- checking for inttypes.h... yes
- checking for stdint.h... yes
- checking for unistd.h... yes
- checking for unistd.h... (cached) yes
- checking fcntl.h usability... yes
- checking fcntl.h presence... yes
- checking for fcntl.h... yes
- checking signal.h usability... yes
- checking signal.h presence... yes
- checking for signal.h... yes
- checking sys/cdefs.h usability... yes
- checking sys/cdefs.h presence... yes
- checking for sys/cdefs.h... yes
- checking for sys/types.h... (cached) yes
- checking for sys/stat.h... (cached) yes
- checking sys/syscall.h usability... yes
- checking sys/syscall.h presence... yes
- checking for sys/syscall.h... yes
- checking for dirent.h that defines DIR... yes
- checking for library containing opendir... none required
- checking for pipe2... yes
- checking for setsid... yes
- checking whether dirfd is declared... yes
- configure: creating ./config.status
- config.status: creating _posixsubprocess_config.h
- building '_posixsubprocess32' extension
- creating build/temp.linux-x86_64-2.7
- gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c _posixsubprocess.c -o build/temp.linux-x86_64-2.7/_posixsubprocess.o
- _posixsubprocess.c:16:20: 致命错误:Python.h:没有那个文件或目录
- #include "Python.h"
- ^
- 编译中断。
- error: command 'gcc' failed with exit status 1
- ----------------------------------------
- ERROR: Command errored out with exit status 1: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ueq7J2/subprocess32/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ueq7J2/subprocess32/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-sOTfk8/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
如下图所示:
2、出现这个错误需要安装python-devel库,通过:yum install python-devel安装,如下图所示:
3、再次执行:python2 -m pip install matplotlib==2.1.0,如下图所示:
ERROR: Cannot uninstall 'pyparsing'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
4、那么需要安装pyparsing包,使用:python2 -m pip install --ignore-installed pyparsing,安装,如下图所示:
5、再次执行python2 -m pip install matplotlib==2.1.0即可成功,如下图所示:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。