config – Sam & Max http://sametmax.com Du code, du cul Tue, 10 Sep 2019 09:14:50 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.7 32490438 Virtualenv EnvironmentError: mysql_config not found sous MAC OSX http://sametmax.com/virtualenv-environmenterror-mysql_config-not-found-sous-mac-osx/ http://sametmax.com/virtualenv-environmenterror-mysql_config-not-found-sous-mac-osx/#comments Tue, 04 Feb 2014 10:56:18 +0000 http://sametmax.com/?p=8963 Comme le post précédent est inutile j’en fais un autre qui doit concerner au moins 0.00001% de la population.

A vous qui essayez depuis 2 heures de configurer MySQL-python sous votre virtualenv, cet article vous est dédié.

Cette erreur vicieuse m’arrive à chaque fois que j’installe MySQL-python dans un nouvel environnement virtuel. Ceci dit vous l’aurez peut-être sous un autre OS. Sur CentOS j’avais qu’à faire un yum install mysql-devel mais sous Mac c’est autre chose. Plus de puissance engendre plus de responsabilités…


Max $  pip install MySQL-python
Downloading/unpacking MySQL-python
  Downloading MySQL-python-1.2.5.zip (108Kb): 108Kb downloaded
  Running setup.py egg_info for package MySQL-python
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "", line 14, in 
      File "/Users/Max/.virtualenvs/zooscator/build/MySQL-python/setup.py", line 17, in 
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found

Traceback (most recent call last):

  File "", line 14, in 

  File "/Users/Max/.virtualenvs/zooscator/build/MySQL-python/setup.py", line 17, in 

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 25, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/Max/.pip/pip.log

Il faut éditer votre fichier activate qui se trouve dans le répertoire bin de votre environnement virtuel: ex “/Users/Max/.virtualenvs/zooscator/bin/activate”

vi /Users/Max/.virtualenvs/zooscator/bin

Trouvez les lignes suivantes et ajoutez:

PATH=”$PATH:/opt/local/lib/mysql5/bin/”

...
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
PATH="$PATH:/opt/local/lib/mysql5/bin/"
export PATH
...

Chez moi le chemin vers mysql est /opt/local/lib/mysql5/bin/, si vous ne connaissez pas le vôtre utilisez la commande locate: ex locate mysql

Une fois le fichier activate édité il faut le resourcer:

source /Users/Max/.virtualenvs/zooscator/bin/activate

Et vous pourrez alors installer MySQL-python tranquillou billou:

Max $  pip install MySQL-python

Downloading/unpacking MySQL-python
  Running setup.py egg_info for package MySQL-python

Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python
[....................]
Successfully installed MySQL-python
Cleaning up...

Je vais nourrir mon cochon d’Inde.

]]>
http://sametmax.com/virtualenv-environmenterror-mysql_config-not-found-sous-mac-osx/feed/ 16 8963