一、前言
在CentOS 上安裝fabric時出現問題,首先已安裝pip, 用pip執行以下指令pip install
出現以下問題
[[email protected] /]$ sudo pip install fabric
Requirement already satisfied (use --upgrade to upgrade): fabric in /usr/lib/python2.6/site-packages/Fabric-1.3.1-py2.6.egg
Requirement already satisfied (use --upgrade to upgrade): ssh>=1.7.8 in /usr/lib/python2.6/site-packages/ssh-1.8.0-py2.6.egg (from fabric)
Downloading/unpacking pycrypto>=2.1,!=2.4 (from ssh>=1.7.8->fabric)
Running setup.py egg_info for package pycrypto
Installing collected packages: pycrypto
Found existing installation: pycrypto 2.0.1
Uninstalling pycrypto:
Successfully uninstalled pycrypto
Running setup.py install for pycrypto
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/MD2.c -o build/temp.linux-i686-2.6/src/MD2.o
src/MD2.c:31:20: 錯誤:Python.h:沒有那個檔案或目錄
src/MD2.c:131: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
In file included from src/MD2.c:147:
src/hash_template.c:48: 錯誤:expected specifier-qualifier-list before ‘PyObject_HEAD’
src/hash_template.c:59: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
src/hash_template.c: 在函數‘newALGobject’中:
src/hash_template.c:69: 警告:隐式聲明函數‘PyObject_New’
src/hash_template.c:69: 錯誤:expected expression before ‘ALGobject’
src/hash_template.c: 在檔案層:
src/hash_template.c:76: 錯誤:expected ‘)’ before ‘*’ token
src/hash_template.c:91: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:110: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:122: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:162: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:188: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:190: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALG_methods’
src/hash_template.c:199: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:225: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALGtype’
src/hash_template.c:271: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:304: 錯誤:數組元素的類型不完全
src/hash_template.c:305: 錯誤:‘PyCFunction’未聲明(不在函數内)
src/hash_template.c:305: 錯誤:expected ‘}’ before ‘ALG_new’
src/hash_template.c: 在函數‘init_MD2’中:
src/hash_template.c:339: 錯誤:‘PyObject’未聲明(在此函數内第一次使用)
src/hash_template.c:339: 錯誤:(即使在一個函數内多次出現,每個未聲明的辨別符在其
src/hash_template.c:339: 錯誤:所在的函數内也隻報告一次。)
src/hash_template.c:339: 錯誤:‘m’未聲明(在此函數内第一次使用)
src/hash_template.c:351: 錯誤:‘ALGtype’未聲明(在此函數内第一次使用)
src/hash_template.c:351: 錯誤:‘PyType_Type’未聲明(在此函數内第一次使用)
src/hash_template.c:352: 警告:隐式聲明函數‘Py_InitModule’
src/hash_template.c:356: 錯誤:‘o’未聲明(在此函數内第一次使用)
src/hash_template.c:356: 警告:隐式聲明函數‘PyInt_FromLong’
src/hash_template.c:356: 警告:隐式聲明函數‘PyDict_SetItemString’
src/hash_template.c:356: 警告:隐式聲明函數‘PyModule_GetDict’
src/hash_template.c:356: 警告:隐式聲明函數‘Py_DECREF’
src/hash_template.c:360: 警告:隐式聲明函數‘PyErr_Occurred’
src/hash_template.c:361: 警告:隐式聲明函數‘Py_FatalError’
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ai6cQR-record/install-record.txt --single-version-externally-managed:
running install
running build
running build_py
running build_ext
running build_configure
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/MD2.c -o build/temp.linux-i686-2.6/src/MD2.o
src/MD2.c:31:20: 錯誤:Python.h:沒有那個檔案或目錄
src/MD2.c:131: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
In file included from src/MD2.c:147:
src/hash_template.c:48: 錯誤:expected specifier-qualifier-list before ‘PyObject_HEAD’
src/hash_template.c:59: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
src/hash_template.c: 在函數‘newALGobject’中:
src/hash_template.c:69: 警告:隐式聲明函數‘PyObject_New’
src/hash_template.c:69: 錯誤:expected expression before ‘ALGobject’
src/hash_template.c: 在檔案層:
src/hash_template.c:76: 錯誤:expected ‘)’ before ‘*’ token
src/hash_template.c:91: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:110: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:122: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:162: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:188: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:190: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALG_methods’
src/hash_template.c:199: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:225: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ALGtype’
src/hash_template.c:271: 錯誤:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
src/hash_template.c:304: 錯誤:數組元素的類型不完全
src/hash_template.c:305: 錯誤:‘PyCFunction’未聲明(不在函數内)
src/hash_template.c:305: 錯誤:expected ‘}’ before ‘ALG_new’
src/hash_template.c: 在函數‘init_MD2’中:
src/hash_template.c:339: 錯誤:‘PyObject’未聲明(在此函數内第一次使用)
src/hash_template.c:339: 錯誤:(即使在一個函數内多次出現,每個未聲明的辨別符在其
src/hash_template.c:339: 錯誤:所在的函數内也隻報告一次。)
src/hash_template.c:339: 錯誤:‘m’未聲明(在此函數内第一次使用)
src/hash_template.c:351: 錯誤:‘ALGtype’未聲明(在此函數内第一次使用)
src/hash_template.c:351: 錯誤:‘PyType_Type’未聲明(在此函數内第一次使用)
src/hash_template.c:352: 警告:隐式聲明函數‘Py_InitModule’
src/hash_template.c:356: 錯誤:‘o’未聲明(在此函數内第一次使用)
src/hash_template.c:356: 警告:隐式聲明函數‘PyInt_FromLong’
src/hash_template.c:356: 警告:隐式聲明函數‘PyDict_SetItemString’
src/hash_template.c:356: 警告:隐式聲明函數‘PyModule_GetDict’
src/hash_template.c:356: 警告:隐式聲明函數‘Py_DECREF’
src/hash_template.c:360: 警告:隐式聲明函數‘PyErr_Occurred’
src/hash_template.c:361: 警告:隐式聲明函數‘Py_FatalError’
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of pycrypto
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ai6cQR-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/pycrypto
Storing complete log in /root/.pip/pip.log
二 解決方案
原因是少了python的dev
[[email protected] /]$ sudo yum install python-devel