在虚拟环境中使用PIP,如何安装MySQL-python
当我在虚拟环境中时,我尝试运行:
pip install MySQL-python
这不起作用,所以我尝试下载软件包并通过运行安装它:
python setup.py install
这会返回以下错误:
% python setup.py install ~VIRTUAL_ENV/build/MySQL-python running install install_dir /home/damon/Workspace/django-projects/acm-cie/env/lib/python2.6/site-packages/ running bdist_egg running egg_info writing MySQL_python.egg-info/PKG-INFO writing top-level names to MySQL_python.egg-info/top_level.txt writing dependency_links to MySQL_python.egg-info/dependency_links.txt reading manifest file 'MySQL_python.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'MANIFEST' warning: no files found matching 'ChangeLog' warning: no files found matching 'GPL' writing manifest file 'MySQL_python.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py copying MySQLdb/release.py -> build/lib.linux-x86_64-2.6/MySQLdb running build_ext building '_mysql' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-x86_64-2.6/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX In file included from _mysql.c:29: pymemcompat.h:10:20: error: Python.h: No such file or directory _mysql.c:30:26: error: structmember.h: No such file or directory _mysql.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:63: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:64: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:65: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:66: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:75: error: expected specifier-qualifier-list before ‘PyObject_HEAD’ _mysql.c:85: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’ _mysql.c:88: error: expected specifier-qualifier-list before ‘PyObject_HEAD’ _mysql.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’ _mysql.c:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:227: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:318: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:336: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:359: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c:360: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ResultObject_Initialize’: _mysql.c:362: error: ‘NULL’ undeclared (first use in this function) _mysql.c:362: error: (Each undeclared identifier is reported only once _mysql.c:362: error: for each function it appears in.) _mysql.c:364: warning: initialization from incompatible pointer type _mysql.c:366: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:366: error: ‘conv’ undeclared (first use in this function) _mysql.c:366: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:366: warning: statement with no effect _mysql.c:370: warning: implicit declaration of function ‘PyArg_ParseTupleAndKeywords’ _mysql.c:370: error: ‘args’ undeclared (first use in this function) _mysql.c:370: error: ‘kwargs’ undeclared (first use in this function) _mysql.c:373: warning: implicit declaration of function ‘PyDict_New’ _mysql.c:373: warning: statement with no effect _mysql.c:375: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:375: error: expected expression before ‘)’ token _mysql.c:375: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:375: warning: statement with no effect _mysql.c:376: warning: implicit declaration of function ‘Py_INCREF’ _mysql.c:377: error: ‘_mysql_ResultObject’ has no member named ‘use’ _mysql.c:377: warning: statement with no effect _mysql.c:378: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:378: warning: statement with no effect _mysql.c:380: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:380: warning: passing argument 1 of ‘mysql_use_result’ from incompatible pointer type /usr/include/mysql/mysql.h:453: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:382: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:382: warning: passing argument 1 of ‘mysql_store_result’ from incompatible pointer type /usr/include/mysql/mysql.h:452: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:383: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:383: warning: statement with no effect _mysql.c:384: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:384: warning: statement with no effect _mysql.c:386: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:386: warning: implicit declaration of function ‘PyTuple_New’ _mysql.c:386: warning: statement with no effect _mysql.c:390: error: ‘_mysql_ResultObject’ has no member named ‘nfields’ _mysql.c:390: warning: statement with no effect _mysql.c:391: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:394: error: ‘tmp’ undeclared (first use in this function) _mysql.c:394: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:394: error: ‘fun’ undeclared (first use in this function) _mysql.c:394: warning: left-hand operand of comma expression has no effect _mysql.c:394: warning: statement with no effect _mysql.c:395: warning: implicit declaration of function ‘PyInt_FromLong’ _mysql.c:395: warning: statement with no effect _mysql.c:397: warning: implicit declaration of function ‘PyObject_GetItem’ _mysql.c:397: warning: statement with no effect _mysql.c:398: warning: implicit declaration of function ‘Py_DECREF’ _mysql.c:400: warning: implicit declaration of function ‘PyErr_Clear’ _mysql.c:401: error: ‘Py_None’ undeclared (first use in this function) _mysql.c:401: warning: statement with no effect _mysql.c:404: warning: implicit declaration of function ‘PySequence_Check’ _mysql.c:405: warning: implicit declaration of function ‘PySequence_Size’ _mysql.c:406: error: ‘fun2’ undeclared (first use in this function) _mysql.c:406: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:406: warning: statement with no effect _mysql.c:408: error: ‘t’ undeclared (first use in this function) _mysql.c:408: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:408: warning: implicit declaration of function ‘PySequence_GetItem’ _mysql.c:408: warning: statement with no effect _mysql.c:410: warning: implicit declaration of function ‘PyTuple_Check’ _mysql.c:411: warning: implicit declaration of function ‘PyTuple_GET_SIZE’ _mysql.c:413: error: ‘pmask’ undeclared (first use in this function) _mysql.c:413: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:413: warning: statement with no effect _mysql.c:414: warning: implicit declaration of function ‘PyTuple_GET_ITEM’ _mysql.c:414: warning: statement with no effect _mysql.c:415: warning: statement with no effect _mysql.c:416: warning: implicit declaration of function ‘PyInt_Check’ _mysql.c:417: warning: implicit declaration of function ‘PyInt_AS_LONG’ _mysql.c:433: warning: statement with no effect _mysql.c:436: warning: statement with no effect _mysql.c:438: warning: implicit declaration of function ‘PyTuple_SET_ITEM’ _mysql.c:438: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c: In function ‘_mysql_ResultObject_clear’: _mysql.c:462: warning: implicit declaration of function ‘Py_XDECREF’ _mysql.c:462: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:463: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:463: error: ‘NULL’ undeclared (first use in this function) _mysql.c:463: warning: statement with no effect _mysql.c:464: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:465: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:465: warning: statement with no effect _mysql.c: At top level: _mysql.c:472: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c:473: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ConnectionObject_Initialize’: _mysql.c:475: error: ‘NULL’ undeclared (first use in this function) _mysql.c:475: warning: initialization from incompatible pointer type _mysql.c:476: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:476: error: ‘conv’ undeclared (first use in this function) _mysql.c:476: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:476: warning: statement with no effect _mysql.c:477: error: ‘ssl’ undeclared (first use in this function) _mysql.c:477: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:477: warning: statement with no effect _mysql.c:479: warning: initialization from incompatible pointer type _mysql.c:479: warning: initialization from incompatible pointer type _mysql.c:479: warning: initialization from incompatible pointer type _mysql.c:480: warning: initialization from incompatible pointer type _mysql.c:480: warning: initialization from incompatible pointer type _mysql.c:482: warning: initialization from incompatible pointer type _mysql.c:482: warning: initialization from incompatible pointer type _mysql.c:482: warning: initialization from incompatible pointer type _mysql.c:483: warning: initialization from incompatible pointer type _mysql.c:483: warning: initialization from incompatible pointer type _mysql.c:493: error: initializer element is not constant _mysql.c:493: error: (near initialization for ‘kwlist[16]’) _mysql.c:496: warning: initialization from incompatible pointer type _mysql.c:497: warning: initialization from incompatible pointer type _mysql.c:498: warning: initialization from incompatible pointer type _mysql.c:500: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:500: warning: statement with no effect _mysql.c:501: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ _mysql.c:501: warning: statement with no effect _mysql.c:502: warning: implicit declaration of function ‘_mysql_Exception’ _mysql.c:503: error: ‘args’ undeclared (first use in this function) _mysql.c:503: error: ‘kwargs’ undeclared (first use in this function) _mysql.c:523: error: ‘value’ undeclared (first use in this function) _mysql.c:523: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:523: warning: statement with no effect _mysql.c:524: warning: implicit declaration of function ‘PyMapping_GetItemString’ _mysql.c:524: warning: statement with no effect _mysql.c:524: warning: implicit declaration of function ‘PyString_AsString’ _mysql.c:524: warning: assignment makes pointer from integer without a cast _mysql.c:525: warning: statement with no effect _mysql.c:525: warning: assignment makes pointer from integer without a cast _mysql.c:526: warning: statement with no effect _mysql.c:526: warning: assignment makes pointer from integer without a cast _mysql.c:527: warning: statement with no effect _mysql.c:527: warning: assignment makes pointer from integer without a cast _mysql.c:528: warning: statement with no effect _mysql.c:528: warning: assignment makes pointer from integer without a cast _mysql.c:536: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:536: warning: statement with no effect _mysql.c:537: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:537: warning: passing argument 1 of ‘mysql_init’ from incompatible pointer type /usr/include/mysql/mysql.h:432: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:540: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:541: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:544: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:544: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:548: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:548: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:549: warning: comparison of distinct pointer types lacks a cast _mysql.c:550: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:550: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:551: warning: comparison of distinct pointer types lacks a cast _mysql.c:552: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:552: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:553: warning: comparison of distinct pointer types lacks a cast _mysql.c:554: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:554: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:557: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:557: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:561: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:562: warning: passing argument 1 of ‘mysql_ssl_set’ from incompatible pointer type /usr/include/mysql/mysql.h:433: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:565: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:566: warning: passing argument 1 of ‘mysql_real_connect’ from incompatible pointer type /usr/include/mysql/mysql.h:439: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:568: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:568: warning: statement with no effect _mysql.c:577: warning: statement with no effect _mysql.c:583: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:583: warning: statement with no effect _mysql.c:591: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ _mysql.c:591: warning: statement with no effect _mysql.c: At top level: _mysql.c:649: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c: In function ‘_mysql_ConnectionObject_clear’: _mysql.c:681: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:682: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:682: error: ‘NULL’ undeclared (first use in this function) _mysql.c:682: warning: statement with no effect _mysql.c: At top level: _mysql.c:689: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:717: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:733: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:751: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:770: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:796: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:818: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:850: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:876: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:903: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:918: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:935: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:951: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:969: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1004: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1035: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1037: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1067: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1097: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1163: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1199: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1223: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1248: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1273: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1312: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1351: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1356: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c:1359: error: expected declaration specifiers or ‘...’ before ‘_PYFUNC’ _mysql.c: In function ‘_mysql__fetch_row’: _mysql.c:1365: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:1365: error: ‘v’ undeclared (first use in this function) _mysql.c:1365: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:1365: warning: statement with no effect _mysql.c:1366: error: ‘_mysql_ResultObject’ has no member named ‘use’ _mysql.c:1367: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:1367: warning: passing argument 1 of ‘mysql_fetch_row’ from incompatible pointer type /usr/include/mysql/mysql.h:547: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’ _mysql.c:1369: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:1369: warning: statement with no effect _mysql.c:1370: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:1370: warning: passing argument 1 of ‘mysql_fetch_row’ from incompatible pointer type /usr/include/mysql/mysql.h:547: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’ _mysql.c:1371: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:1371: warning: statement with no effect _mysql.c:1373: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:1373: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:1373: warning: passing argument 1 of ‘mysql_errno’ from incompatible pointer type /usr/include/mysql/mysql.h:423: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:1374: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:1378: warning: implicit declaration of function ‘_PyTuple_Resize’ _mysql.c:1378: error: ‘r’ undeclared (first use in this function) _mysql.c:1381: warning: implicit declaration of function ‘convert_row’ _mysql.c:1381: warning: statement with no effect _mysql.c: At top level: _mysql.c:1399: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1478: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1506: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1528: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1568: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1597: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1612: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1627: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1642: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1658: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1693: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1711: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1734: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1751: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1767: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1796: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1819: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1849: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1871: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1898: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1919: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1960: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1980: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c: In function ‘_mysql_ConnectionObject_dealloc’: _mysql.c:2014: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:2014: error: ‘o’ undeclared (first use in this function) _mysql.c:2014: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:2014: warning: statement with no effect _mysql.c:2017: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ _mysql.c:2018: warning: implicit declaration of function ‘_mysql_ConnectionObject_close’ _mysql.c:2018: error: ‘NULL’ undeclared (first use in this function) _mysql.c:2018: warning: statement with no effect _mysql.c:2021: warning: implicit declaration of function ‘PyMem_Free’ _mysql.c: At top level: _mysql.c:2024: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2041: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2056: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2078: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c: In function ‘_mysql_ResultObject_dealloc’: _mysql.c:2100: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:2100: warning: passing argument 1 of ‘mysql_free_result’ from incompatible pointer type /usr/include/mysql/mysql.h:540: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’ _mysql.c: At top level: _mysql.c:2105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_methods’ _mysql.c:2330: error: array type has incomplete element type _mysql.c:2331: error: ‘T_INT’ undeclared here (not in a function) _mysql.c:2331: warning: implicit declaration of function ‘offsetof’ _mysql.c:2331: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2331: error: ‘RO’ undeclared here (not in a function) _mysql.c:2338: error: ‘T_OBJECT’ undeclared here (not in a function) _mysql.c:2338: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2345: error: ‘T_UINT’ undeclared here (not in a function) _mysql.c:2345: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2352: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2359: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2366: error: ‘NULL’ undeclared here (not in a function) _mysql.c:2369: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_methods’ _mysql.c:2421: error: array type has incomplete element type _mysql.c:2422: error: expected expression before ‘_mysql_ResultObject’ _mysql.c:2432: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2460: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2490: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ConnectionObject_setattr’: _mysql.c:2492: error: ‘v’ undeclared (first use in this function) _mysql.c:2493: warning: implicit declaration of function ‘PyErr_SetString’ _mysql.c:2493: error: ‘PyExc_AttributeError’ undeclared (first use in this function) _mysql.c:2498: warning: implicit declaration of function ‘PyMember_Set’ _mysql.c: At top level: _mysql.c:2515: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ResultObject_setattr’: _mysql.c:2517: error: ‘v’ undeclared (first use in this function) _mysql.c:2518: error: ‘PyExc_AttributeError’ undeclared (first use in this function) _mysql.c: At top level: _mysql.c:2536: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’ _mysql.c:2620: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’ _mysql.c:2706: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_methods’ _mysql.c:2778: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2810: warning: return type defaults to ‘int’ _mysql.c: In function ‘DL_EXPORT’: _mysql.c:2810: error: expected declaration specifiers before ‘init_mysql’ _mysql.c:2888: error: expected ‘{’ at end of input error: command 'gcc' failed with exit status 1
How can I install MySQL-python on Ubuntu in a virtual启用“no-site-packages”的环境?
When I'm in my virtual environment, I attempt to run:
pip install MySQL-python
This didn't work, so I tried downloading the package and installing it by running:
python setup.py install
This returns the following error:
% python setup.py install ~VIRTUAL_ENV/build/MySQL-python running install install_dir /home/damon/Workspace/django-projects/acm-cie/env/lib/python2.6/site-packages/ running bdist_egg running egg_info writing MySQL_python.egg-info/PKG-INFO writing top-level names to MySQL_python.egg-info/top_level.txt writing dependency_links to MySQL_python.egg-info/dependency_links.txt reading manifest file 'MySQL_python.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'MANIFEST' warning: no files found matching 'ChangeLog' warning: no files found matching 'GPL' writing manifest file 'MySQL_python.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py copying MySQLdb/release.py -> build/lib.linux-x86_64-2.6/MySQLdb running build_ext building '_mysql' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-x86_64-2.6/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX In file included from _mysql.c:29: pymemcompat.h:10:20: error: Python.h: No such file or directory _mysql.c:30:26: error: structmember.h: No such file or directory _mysql.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:63: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:64: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:65: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:66: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:75: error: expected specifier-qualifier-list before ‘PyObject_HEAD’ _mysql.c:85: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’ _mysql.c:88: error: expected specifier-qualifier-list before ‘PyObject_HEAD’ _mysql.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’ _mysql.c:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:227: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:318: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:336: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:359: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c:360: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ResultObject_Initialize’: _mysql.c:362: error: ‘NULL’ undeclared (first use in this function) _mysql.c:362: error: (Each undeclared identifier is reported only once _mysql.c:362: error: for each function it appears in.) _mysql.c:364: warning: initialization from incompatible pointer type _mysql.c:366: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:366: error: ‘conv’ undeclared (first use in this function) _mysql.c:366: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:366: warning: statement with no effect _mysql.c:370: warning: implicit declaration of function ‘PyArg_ParseTupleAndKeywords’ _mysql.c:370: error: ‘args’ undeclared (first use in this function) _mysql.c:370: error: ‘kwargs’ undeclared (first use in this function) _mysql.c:373: warning: implicit declaration of function ‘PyDict_New’ _mysql.c:373: warning: statement with no effect _mysql.c:375: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:375: error: expected expression before ‘)’ token _mysql.c:375: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:375: warning: statement with no effect _mysql.c:376: warning: implicit declaration of function ‘Py_INCREF’ _mysql.c:377: error: ‘_mysql_ResultObject’ has no member named ‘use’ _mysql.c:377: warning: statement with no effect _mysql.c:378: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:378: warning: statement with no effect _mysql.c:380: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:380: warning: passing argument 1 of ‘mysql_use_result’ from incompatible pointer type /usr/include/mysql/mysql.h:453: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:382: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:382: warning: passing argument 1 of ‘mysql_store_result’ from incompatible pointer type /usr/include/mysql/mysql.h:452: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:383: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:383: warning: statement with no effect _mysql.c:384: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:384: warning: statement with no effect _mysql.c:386: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:386: warning: implicit declaration of function ‘PyTuple_New’ _mysql.c:386: warning: statement with no effect _mysql.c:390: error: ‘_mysql_ResultObject’ has no member named ‘nfields’ _mysql.c:390: warning: statement with no effect _mysql.c:391: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:394: error: ‘tmp’ undeclared (first use in this function) _mysql.c:394: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:394: error: ‘fun’ undeclared (first use in this function) _mysql.c:394: warning: left-hand operand of comma expression has no effect _mysql.c:394: warning: statement with no effect _mysql.c:395: warning: implicit declaration of function ‘PyInt_FromLong’ _mysql.c:395: warning: statement with no effect _mysql.c:397: warning: implicit declaration of function ‘PyObject_GetItem’ _mysql.c:397: warning: statement with no effect _mysql.c:398: warning: implicit declaration of function ‘Py_DECREF’ _mysql.c:400: warning: implicit declaration of function ‘PyErr_Clear’ _mysql.c:401: error: ‘Py_None’ undeclared (first use in this function) _mysql.c:401: warning: statement with no effect _mysql.c:404: warning: implicit declaration of function ‘PySequence_Check’ _mysql.c:405: warning: implicit declaration of function ‘PySequence_Size’ _mysql.c:406: error: ‘fun2’ undeclared (first use in this function) _mysql.c:406: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:406: warning: statement with no effect _mysql.c:408: error: ‘t’ undeclared (first use in this function) _mysql.c:408: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:408: warning: implicit declaration of function ‘PySequence_GetItem’ _mysql.c:408: warning: statement with no effect _mysql.c:410: warning: implicit declaration of function ‘PyTuple_Check’ _mysql.c:411: warning: implicit declaration of function ‘PyTuple_GET_SIZE’ _mysql.c:413: error: ‘pmask’ undeclared (first use in this function) _mysql.c:413: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:413: warning: statement with no effect _mysql.c:414: warning: implicit declaration of function ‘PyTuple_GET_ITEM’ _mysql.c:414: warning: statement with no effect _mysql.c:415: warning: statement with no effect _mysql.c:416: warning: implicit declaration of function ‘PyInt_Check’ _mysql.c:417: warning: implicit declaration of function ‘PyInt_AS_LONG’ _mysql.c:433: warning: statement with no effect _mysql.c:436: warning: statement with no effect _mysql.c:438: warning: implicit declaration of function ‘PyTuple_SET_ITEM’ _mysql.c:438: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c: In function ‘_mysql_ResultObject_clear’: _mysql.c:462: warning: implicit declaration of function ‘Py_XDECREF’ _mysql.c:462: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:463: error: ‘_mysql_ResultObject’ has no member named ‘converter’ _mysql.c:463: error: ‘NULL’ undeclared (first use in this function) _mysql.c:463: warning: statement with no effect _mysql.c:464: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:465: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:465: warning: statement with no effect _mysql.c: At top level: _mysql.c:472: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c:473: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ConnectionObject_Initialize’: _mysql.c:475: error: ‘NULL’ undeclared (first use in this function) _mysql.c:475: warning: initialization from incompatible pointer type _mysql.c:476: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:476: error: ‘conv’ undeclared (first use in this function) _mysql.c:476: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:476: warning: statement with no effect _mysql.c:477: error: ‘ssl’ undeclared (first use in this function) _mysql.c:477: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:477: warning: statement with no effect _mysql.c:479: warning: initialization from incompatible pointer type _mysql.c:479: warning: initialization from incompatible pointer type _mysql.c:479: warning: initialization from incompatible pointer type _mysql.c:480: warning: initialization from incompatible pointer type _mysql.c:480: warning: initialization from incompatible pointer type _mysql.c:482: warning: initialization from incompatible pointer type _mysql.c:482: warning: initialization from incompatible pointer type _mysql.c:482: warning: initialization from incompatible pointer type _mysql.c:483: warning: initialization from incompatible pointer type _mysql.c:483: warning: initialization from incompatible pointer type _mysql.c:493: error: initializer element is not constant _mysql.c:493: error: (near initialization for ‘kwlist[16]’) _mysql.c:496: warning: initialization from incompatible pointer type _mysql.c:497: warning: initialization from incompatible pointer type _mysql.c:498: warning: initialization from incompatible pointer type _mysql.c:500: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:500: warning: statement with no effect _mysql.c:501: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ _mysql.c:501: warning: statement with no effect _mysql.c:502: warning: implicit declaration of function ‘_mysql_Exception’ _mysql.c:503: error: ‘args’ undeclared (first use in this function) _mysql.c:503: error: ‘kwargs’ undeclared (first use in this function) _mysql.c:523: error: ‘value’ undeclared (first use in this function) _mysql.c:523: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:523: warning: statement with no effect _mysql.c:524: warning: implicit declaration of function ‘PyMapping_GetItemString’ _mysql.c:524: warning: statement with no effect _mysql.c:524: warning: implicit declaration of function ‘PyString_AsString’ _mysql.c:524: warning: assignment makes pointer from integer without a cast _mysql.c:525: warning: statement with no effect _mysql.c:525: warning: assignment makes pointer from integer without a cast _mysql.c:526: warning: statement with no effect _mysql.c:526: warning: assignment makes pointer from integer without a cast _mysql.c:527: warning: statement with no effect _mysql.c:527: warning: assignment makes pointer from integer without a cast _mysql.c:528: warning: statement with no effect _mysql.c:528: warning: assignment makes pointer from integer without a cast _mysql.c:536: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:536: warning: statement with no effect _mysql.c:537: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:537: warning: passing argument 1 of ‘mysql_init’ from incompatible pointer type /usr/include/mysql/mysql.h:432: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:540: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:541: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:544: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:544: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:548: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:548: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:549: warning: comparison of distinct pointer types lacks a cast _mysql.c:550: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:550: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:551: warning: comparison of distinct pointer types lacks a cast _mysql.c:552: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:552: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:553: warning: comparison of distinct pointer types lacks a cast _mysql.c:554: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:554: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:557: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:557: warning: passing argument 1 of ‘mysql_options’ from incompatible pointer type /usr/include/mysql/mysql.h:538: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:561: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:562: warning: passing argument 1 of ‘mysql_ssl_set’ from incompatible pointer type /usr/include/mysql/mysql.h:433: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:565: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:566: warning: passing argument 1 of ‘mysql_real_connect’ from incompatible pointer type /usr/include/mysql/mysql.h:439: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:568: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:568: warning: statement with no effect _mysql.c:577: warning: statement with no effect _mysql.c:583: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:583: warning: statement with no effect _mysql.c:591: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ _mysql.c:591: warning: statement with no effect _mysql.c: At top level: _mysql.c:649: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c: In function ‘_mysql_ConnectionObject_clear’: _mysql.c:681: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:682: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’ _mysql.c:682: error: ‘NULL’ undeclared (first use in this function) _mysql.c:682: warning: statement with no effect _mysql.c: At top level: _mysql.c:689: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:717: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:733: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:751: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:770: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:796: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:818: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:850: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:876: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:903: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:918: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:935: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:951: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:969: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1004: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1035: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1037: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1067: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1097: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1163: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1199: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1223: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1248: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1273: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1312: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1351: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1356: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c:1359: error: expected declaration specifiers or ‘...’ before ‘_PYFUNC’ _mysql.c: In function ‘_mysql__fetch_row’: _mysql.c:1365: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:1365: error: ‘v’ undeclared (first use in this function) _mysql.c:1365: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:1365: warning: statement with no effect _mysql.c:1366: error: ‘_mysql_ResultObject’ has no member named ‘use’ _mysql.c:1367: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:1367: warning: passing argument 1 of ‘mysql_fetch_row’ from incompatible pointer type /usr/include/mysql/mysql.h:547: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’ _mysql.c:1369: error: ‘Py_BEGIN_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:1369: warning: statement with no effect _mysql.c:1370: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:1370: warning: passing argument 1 of ‘mysql_fetch_row’ from incompatible pointer type /usr/include/mysql/mysql.h:547: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’ _mysql.c:1371: error: ‘Py_END_ALLOW_THREADS’ undeclared (first use in this function) _mysql.c:1371: warning: statement with no effect _mysql.c:1373: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:1373: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’ _mysql.c:1373: warning: passing argument 1 of ‘mysql_errno’ from incompatible pointer type /usr/include/mysql/mysql.h:423: note: expected ‘struct MYSQL *’ but argument is of type ‘char * (*)[1]’ _mysql.c:1374: error: ‘_mysql_ResultObject’ has no member named ‘conn’ _mysql.c:1378: warning: implicit declaration of function ‘_PyTuple_Resize’ _mysql.c:1378: error: ‘r’ undeclared (first use in this function) _mysql.c:1381: warning: implicit declaration of function ‘convert_row’ _mysql.c:1381: warning: statement with no effect _mysql.c: At top level: _mysql.c:1399: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1478: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1506: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1528: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1568: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1597: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1612: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1627: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1642: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1658: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1693: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1711: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1734: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1751: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1767: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1796: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1819: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1849: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1871: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1898: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1919: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1960: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:1980: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c: In function ‘_mysql_ConnectionObject_dealloc’: _mysql.c:2014: error: ‘PyObject’ undeclared (first use in this function) _mysql.c:2014: error: ‘o’ undeclared (first use in this function) _mysql.c:2014: error: invalid operands to binary * (have ‘char **’ and ‘char **’) _mysql.c:2014: warning: statement with no effect _mysql.c:2017: error: ‘_mysql_ConnectionObject’ has no member named ‘open’ _mysql.c:2018: warning: implicit declaration of function ‘_mysql_ConnectionObject_close’ _mysql.c:2018: error: ‘NULL’ undeclared (first use in this function) _mysql.c:2018: warning: statement with no effect _mysql.c:2021: warning: implicit declaration of function ‘PyMem_Free’ _mysql.c: At top level: _mysql.c:2024: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2041: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2056: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2078: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c: In function ‘_mysql_ResultObject_dealloc’: _mysql.c:2100: error: ‘_mysql_ResultObject’ has no member named ‘result’ _mysql.c:2100: warning: passing argument 1 of ‘mysql_free_result’ from incompatible pointer type /usr/include/mysql/mysql.h:540: note: expected ‘struct MYSQL_RES *’ but argument is of type ‘char **’ _mysql.c: At top level: _mysql.c:2105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_methods’ _mysql.c:2330: error: array type has incomplete element type _mysql.c:2331: error: ‘T_INT’ undeclared here (not in a function) _mysql.c:2331: warning: implicit declaration of function ‘offsetof’ _mysql.c:2331: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2331: error: ‘RO’ undeclared here (not in a function) _mysql.c:2338: error: ‘T_OBJECT’ undeclared here (not in a function) _mysql.c:2338: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2345: error: ‘T_UINT’ undeclared here (not in a function) _mysql.c:2345: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2352: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2359: error: expected expression before ‘_mysql_ConnectionObject’ _mysql.c:2366: error: ‘NULL’ undeclared here (not in a function) _mysql.c:2369: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_methods’ _mysql.c:2421: error: array type has incomplete element type _mysql.c:2422: error: expected expression before ‘_mysql_ResultObject’ _mysql.c:2432: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2460: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2490: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ConnectionObject_setattr’: _mysql.c:2492: error: ‘v’ undeclared (first use in this function) _mysql.c:2493: warning: implicit declaration of function ‘PyErr_SetString’ _mysql.c:2493: error: ‘PyExc_AttributeError’ undeclared (first use in this function) _mysql.c:2498: warning: implicit declaration of function ‘PyMember_Set’ _mysql.c: At top level: _mysql.c:2515: error: expected declaration specifiers or ‘...’ before ‘PyObject’ _mysql.c: In function ‘_mysql_ResultObject_setattr’: _mysql.c:2517: error: ‘v’ undeclared (first use in this function) _mysql.c:2518: error: ‘PyExc_AttributeError’ undeclared (first use in this function) _mysql.c: At top level: _mysql.c:2536: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ConnectionObject_Type’ _mysql.c:2620: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_ResultObject_Type’ _mysql.c:2706: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_mysql_methods’ _mysql.c:2778: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token _mysql.c:2810: warning: return type defaults to ‘int’ _mysql.c: In function ‘DL_EXPORT’: _mysql.c:2810: error: expected declaration specifiers before ‘init_mysql’ _mysql.c:2888: error: expected ‘{’ at end of input error: command 'gcc' failed with exit status 1
How can I install MySQL-python on Ubuntu in a virtual environment with "no-site-packages" enabled?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发生这种情况的原因是因为我需要安装 python-dev 包(我愚蠢地认为已经安装了)。
其次是
The reason this was occurring is because I need to install the python-dev package (which I stupidly assumed had already been installed).
followed by
您可能还需要在某些 Ubuntu 安装中安装 libmysqlclient-dev
这就是阻碍我的原因(在 python-dev 之上)。
You might also need to install libmysqlclient-dev in some Ubuntu installations
That's what was holding me back (on top of python-dev).