我在Fedora 26上运行的Python应用程序在Fedora 27上不起作用。
我收到此错误:
ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
我在升级到Fedora 26后创建了一个新的virtualenv.mariadb-devel已安装。
答案 0 :(得分:9)
这是一种解决方法:在文件的第344行添加unsigned int reconnect;
:/ usr / include / mysql / mysql.h。结构应如下所示:
typedef struct st_mysql {
NET net; /* Communication parameters */
void *unused_0;
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info,*db;
const struct ma_charset_info_st *charset; /* character set */
MYSQL_FIELD *fields;
MA_MEM_ROOT field_alloc;
unsigned long long affected_rows;
unsigned long long insert_id; /* id if insert on table with NEXTNR */
unsigned long long extra_info; /* Used by mysqlshow */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
unsigned long client_flag;
unsigned long server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
unsigned int warning_count; /* warning count, added in 4.1 protocol */
unsigned int reconnect;
struct st_mysql_options options;
enum mysql_status status;
my_bool free_me; /* If free in mysql_close */
my_bool unused_1;
char scramble_buff[20+ 1];
/* madded after 3.23.58 */
my_bool unused_2;
void *unused_3, *unused_4, *unused_5, *unused_6;
LIST *stmts;
const struct st_mariadb_methods *methods;
void *thd;
my_bool *unbuffered_fetch_owner;
char *info_buffer;
struct st_mariadb_extension *extension;
} MYSQL;
答案 1 :(得分:2)
可以通过运行命令来解决问题
sed '/st_mysql_options options;/a unsigned int reconnect;' /usr/include/mysql/mysql.h -i.bkp
此修复程序来自https://github.com/DefectDojo/django-DefectDojo/issues/407
答案 2 :(得分:0)
尝试使用以下方法重新安装MySQL-python:
sudo python -m pip install --no-binary MySQL-python MySQL-python