当前位置:   article > 正文

Centos7通过pip安装matplotlib出现_posixsubprocess.c:16:20: 致命错误:Python.h:没有那个文件或目录_centos matplotlib 离线安装 python.h:没有那个文件或目录

centos matplotlib 离线安装 python.h:没有那个文件或目录

1、在通过python2 -m pip install matplotlib=2.2.4时出现以下错误:

  1. 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
  2. Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
  3. Collecting matplotlib==2.1.0
  4. Downloading http://mirrors.aliyun.com/pypi/packages/89/b2/41ae0d5922a8018c1f506ef9b9363fca60326c8b24241b13ecaf80fede47/matplotlib-2.1.0-cp27-cp27mu-manylinux1_x86_64.whl (14.9MB)
  5. |████████████████████████████████| 14.9MB 10.6MB/s
  6. Collecting subprocess32
  7. Downloading http://mirrors.aliyun.com/pypi/packages/32/c8/564be4d12629b912ea431f1a50eb8b3b9d00f1a0b1ceff17f266be190007/subprocess32-3.5.4.tar.gz (97kB)
  8. |████████████████████████████████| 102kB 14.0MB/s
  9. Collecting cycler>=0.10
  10. Downloading http://mirrors.aliyun.com/pypi/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
  11. Requirement already satisfied: six>=1.10 in /usr/lib/python2.7/site-packages (from matplotlib==2.1.0) (1.12.0)
  12. Collecting backports.functools-lru-cache
  13. Downloading http://mirrors.aliyun.com/pypi/packages/03/8e/2424c0e65c4a066e28f539364deee49b6451f8fcd4f718fefa50cc3dcf48/backports.functools_lru_cache-1.5-py2.py3-none-any.whl
  14. Requirement already satisfied: pytz in /usr/lib/python2.7/site-packages (from matplotlib==2.1.0) (2016.10)
  15. Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1
  16. Downloading http://mirrors.aliyun.com/pypi/packages/11/fa/0160cd525c62d7abd076a070ff02b2b94de589f1a9789774f17d7c54058e/pyparsing-2.4.2-py2.py3-none-any.whl (65kB)
  17. |████████████████████████████████| 71kB 11.7MB/s
  18. Requirement already satisfied: numpy>=1.7.1 in /usr/lib64/python2.7/site-packages (from matplotlib==2.1.0) (1.16.5)
  19. Requirement already satisfied: python-dateutil>=2.0 in /usr/lib/python2.7/site-packages (from matplotlib==2.1.0) (2.8.0)
  20. Installing collected packages: subprocess32, cycler, backports.functools-lru-cache, pyparsing, matplotlib
  21. Running setup.py install for subprocess32 ... error
  22. ERROR: Command errored out with exit status 1:
  23. 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
  24. cwd: /tmp/pip-install-ueq7J2/subprocess32/
  25. Complete output (62 lines):
  26. /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  27. warnings.warn(msg)
  28. running install
  29. running build
  30. running build_py
  31. creating build
  32. creating build/lib.linux-x86_64-2.7
  33. copying subprocess32.py -> build/lib.linux-x86_64-2.7
  34. running build_ext
  35. running build_configure
  36. checking for gcc... gcc
  37. checking whether the C compiler works... yes
  38. checking for C compiler default output file name... a.out
  39. checking for suffix of executables...
  40. checking whether we are cross compiling... no
  41. checking for suffix of object files... o
  42. checking whether we are using the GNU C compiler... yes
  43. checking whether gcc accepts -g... yes
  44. checking for gcc option to accept ISO C89... none needed
  45. checking how to run the C preprocessor... gcc -E
  46. checking for grep that handles long lines and -e... /usr/bin/grep
  47. checking for egrep... /usr/bin/grep -E
  48. checking for ANSI C header files... yes
  49. checking for sys/types.h... yes
  50. checking for sys/stat.h... yes
  51. checking for stdlib.h... yes
  52. checking for string.h... yes
  53. checking for memory.h... yes
  54. checking for strings.h... yes
  55. checking for inttypes.h... yes
  56. checking for stdint.h... yes
  57. checking for unistd.h... yes
  58. checking for unistd.h... (cached) yes
  59. checking fcntl.h usability... yes
  60. checking fcntl.h presence... yes
  61. checking for fcntl.h... yes
  62. checking signal.h usability... yes
  63. checking signal.h presence... yes
  64. checking for signal.h... yes
  65. checking sys/cdefs.h usability... yes
  66. checking sys/cdefs.h presence... yes
  67. checking for sys/cdefs.h... yes
  68. checking for sys/types.h... (cached) yes
  69. checking for sys/stat.h... (cached) yes
  70. checking sys/syscall.h usability... yes
  71. checking sys/syscall.h presence... yes
  72. checking for sys/syscall.h... yes
  73. checking for dirent.h that defines DIR... yes
  74. checking for library containing opendir... none required
  75. checking for pipe2... yes
  76. checking for setsid... yes
  77. checking whether dirfd is declared... yes
  78. configure: creating ./config.status
  79. config.status: creating _posixsubprocess_config.h
  80. building '_posixsubprocess32' extension
  81. creating build/temp.linux-x86_64-2.7
  82. 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
  83. _posixsubprocess.c:16:20: 致命错误:Python.h:没有那个文件或目录
  84. #include "Python.h"
  85. ^
  86. 编译中断。
  87. error: command 'gcc' failed with exit status 1
  88. ----------------------------------------
  89. 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即可成功,如下图所示:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/282566
推荐阅读
相关标签
  

闽ICP备14008679号