centos 7 MySQLdb-pythonエラー解決策のインストール

5818 ワード

運転pip install MySQL-pythonエラー:
Command python setup.py egg_info failed with error code 1 in 

探り続ける
 yum install mysql-devel
 systemctl restart mariadb

インストールエラー:
 Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-GMXMYA/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r
'
, '
'
);f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-VMNV_c-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /t mp/pip-build-GMXMYA/MySQL-python/

インストールを続行
 yum install MySQL-python 
 systemctl restart mariadb 

インストールに成功したかどうかをテスト
 python 

pythonに入ってから実行
>>> import MySQLdb
>>> print dir(MySQLdb)
['BINARY', 'Binary', 'Connect', 'Connection', 'DATE', 'DATETIME', 'DBAPISet', 'DataError', 'DatabaseError', 'Date', 'DateFromTicks', 'Error', 'FIELD_TYPE', 'IntegrityError', 'InterfaceError'
, 'InternalError', 'MySQLError', 'NULL', 'NUMBER', 'NotSupportedError', 'OperationalError', 'ProgrammingError', 'ROWID', 'STRING', 'TIME', 'TIMESTAMP', 'Time', 'TimeFromTicks', 'Timestamp', 
'TimestampFromTicks', 'Warning', '__all__', '__author__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__revision__', '__version__', '_mysql', 'apilevel', '
connect', 'connection', 'constants', 'debug', 'escape', 'escape_dict', 'escape_sequence', 'escape_string', 'get_client_info', 'paramstyle', 'release', 'result', 'server_end', 'server_init', 
'string_literal', 'test_DBAPISet_set_equality', 'test_DBAPISet_set_equality_membership', 'test_DBAPISet_set_inequality', 'test_DBAPISet_set_inequality_membership', 'thread_safe', 'threadsafe
ty', 'times', 'version_info']
yum install MySQLdb-python Authorの代わりにpip install MySQLdb-pythonが使用されるからです[email protected]~へへへ