2016-01-04 28 views
2

我正在嘗試在我的Linux Mint 17.2 Cinnamon上安裝4Suite-XML 1.02。我下載了tar.gz,解壓縮了它,在提取的目錄中打開了一個終端,轉移到了根shell,並且運行了sudo su,並運行了python setup.py install。我得到這個作爲輸出:#include <Python.h> - 編譯在Linux上終止Mint

running install 
running build 
running config 
running build_py 
running build_ext 
building 'Ft.Lib.number' extension 
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c   Ft/Lib/src/number.c -o build/temp.linux-x86_64-2.7/Ft/Lib/src/number.o 
Ft/Lib/src/number.c:7:20: fatal error: Python.h: No such file or directory 
#include <Python.h> 
       ^
compilation terminated. 
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

回答

4

通常的Linux發行版分裂的編程語言運行時間兩個包和Python也不例外。

  • python - Python代碼運行時

  • python-dev - 發展的文件,庫和頭文件。需要安裝任何本機擴展。針對開發者。將Python與「本地」C庫集成在一起的東西。 Python代碼可以跨操作系統移植,C代碼不是。 C代碼必須重新編譯到每個操作系統。

你需要安裝相關python-dev包包含必要的編譯Python的原生擴展C頭文件。這個命令通常在基於Debian的發行版上是sudo apt install python-dev。我沒有檢查過Mint Linux的實際命令,但我認爲它是一樣的。

另外請閱讀官方Python軟件包安裝指南https://packaging.python.org/en/latest/installing.html - 通常不需要安裝和python setup.py installpip install --user命令應該能夠爲你下載,提取並安裝軟件包。

+0

如何找到 「相關的python-dev軟件包」?我不明白你的意思。 – Rohan

+0

好的讓我澄清。 –

+0

此外,我嘗試使用pip命令(與sudo,因爲我希望它不僅爲我的用戶安裝)。我有另一個錯誤...我應該在這裏發佈? – Rohan

2

嘗試:

sudo apt-get install python-dev python3-dev