解決python 缺少 'python.

  • 2020 年 1 月 10 日
  • 筆記

最近用pip安裝工具包老是出現錯誤

錯誤如下:

In file included from greenlet.c:5:0:

greenlet.h:8:20: 致命錯誤: Python.h:沒有那個文件或目錄

編譯中斷。

error: Setup script exited with error: command 'gcc' failed with exit status 1 

解決方法是安裝python-dev,這是Python的頭文件和靜態庫包:

ubuntu 下安裝

sudo apt-get install python-dev

Centos 下安裝

yum install python-devel