virtualenv gcc error MySQL-python

3

Eu estou tentando instalar o MySQL-python através do PuTTY com virtualenv.

Especificações.
* CentOS-6.0
* Python2.6

Então eu li muitos sites e a maior coisa que eu vejo é python-dev e python-devel (btw eu não sei a diferença). Eu não consigo fazer isso para instalar, Sudo, yum, easy_install e pip são o que eu tentei. Eu não sou o administrador deste servidor tão sudo e yum não posso executar. Eu tive o administrador tentar instalar, ambos, no servidor dist. de python e meu virtualenv. Ambos dizem que não há nada para fazer. Aqui está o erro que eu recebo ao tentar instalar o MySQL-python-1.2.3

_mysql.c:1928: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:1929: error: â_mysql_ConnectionObjectâ has no member named âconverterâ
_mysql.c:1938: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c: In function â_mysql_ConnectionObject_thread_idâ:
_mysql.c:1967: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:1969: warning: implicit declaration of function âmysql_thread_idâ
_mysql.c:1969: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c: In function â_mysql_ConnectionObject_use_resultâ:
_mysql.c:1989: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:1990: error: â_mysql_ConnectionObjectâ has no member named âconverterâ
_mysql.c:1999: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c: In function â_mysql_ConnectionObject_deallocâ:
_mysql.c:2017: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c: In function â_mysql_ConnectionObject_reprâ:
_mysql.c:2029: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:2031: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c: In function â_mysql_ResultObject_data_seekâ:
_mysql.c:2048: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:2049: warning: implicit declaration of function âmysql_data_seekâ
_mysql.c:2049: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c: In function â_mysql_ResultObject_row_seekâ:
_mysql.c:2062: error: âMYSQL_ROW_OFFSETâ undeclared (first use in this function)
_mysql.c:2062: error: expected â;â before ârâ
_mysql.c:2064: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:2065: error: â_mysql_ResultObjectâ has no member named âuseâ
_mysql.c:2070: error: ârâ undeclared (first use in this function)
_mysql.c:2070: warning: implicit declaration of function âmysql_row_tellâ
_mysql.c:2070: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c:2071: warning: implicit declaration of function âmysql_row_seekâ
_mysql.c:2071: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c: In function â_mysql_ResultObject_row_tellâ:
_mysql.c:2083: error: âMYSQL_ROW_OFFSETâ undeclared (first use in this function)
_mysql.c:2083: error: expected â;â before ârâ
_mysql.c:2085: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:2086: error: â_mysql_ResultObjectâ has no member named âuseâ
_mysql.c:2091: error: ârâ undeclared (first use in this function)
_mysql.c:2091: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c:2092: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c: In function â_mysql_ResultObject_deallocâ:
_mysql.c:2100: warning: implicit declaration of function âmysql_free_resultâ
_mysql.c:2100: error: â_mysql_ResultObjectâ has no member named âresultâ
_mysql.c: At top level:
_mysql.c:2331: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:2338: error: â_mysql_ConnectionObjectâ has no member named âconverterâ
_mysql.c:2345: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c:2352: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c:2359: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c:2422: error: â_mysql_ResultObjectâ has no member named âconverterâ
_mysql.c:2422: error: initializer element is not constant
_mysql.c:2422: error: (near initialization for     â_mysql_ResultObject_memberlist[0].offsetâ)
_mysql.c: In function â_mysql_ConnectionObject_getattrâ:
_mysql.c:2444: error: â_mysql_ConnectionObjectâ has no member named âopenâ
error: command 'gcc' failed with exit status 1

Desculpe, não consigo obter o erro completo no PuTTY

    
por Nathan McAfee 03.11.2011 / 21:02

1 resposta

2

O arquivo README localizado na fonte do mysql-python declara os Pré-requisitos:

  • Python 2.3.4 ou superior
  • setuptools
  • MySQL 3.23.32 ou superior (com muitas estipulações não vou postar)
  • mysql-devel
  • mysql
  • zlib
  • zlib-devel
  • openssl
  • gcc

Então, tente o seguinte:

yum -y install mysql-devel mysql zlib zlib-devel openssl

Em seguida, tente instalar novamente:

pip install mysql-python

( easy_install é depreciado em favor de pip , então acostume-se a usar isso)

E sem vergonha: aqui está uma rápida descrição em ambientes virtuais e um link para um mais completo . Dê uma olhada no script activate , e você verá que apenas preenche o caminho para o diretório ./bin/ para o seu $PATH , então você pode endereçar a mesma instância do python simplesmente antecipando o caminho para o binário.

    
por 03.11.2011 / 21:31