开发者

What package should I use to query Mysql Databases in Python?

开发者 https://www.devze.com 2023-03-06 20:07 出处:网络
I need to query a Mysql database with Python. I have virtual env installed and also PIP, I have tried to install this package, http://pypi.python.org/pyp开发者_C百科i/MySQL-python/#downloads but with

I need to query a Mysql database with Python.

I have virtual env installed and also PIP, I have tried to install this package, http://pypi.python.org/pyp开发者_C百科i/MySQL-python/#downloads but without success.

I have parformed the command:

sudo pip install http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f

And I have got the error:

(python_virtualenv)andre@ubuntu:~/workspace/RS_r/src$ sudo pip install http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
[sudo] password for andre: 
Downloading/unpacking http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package from http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/tmp/pip-l0kPkg-build/setup.py", line 15, in <module>
    metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, 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: not found

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/tmp/pip-l0kPkg-build/setup.py", line 15, in <module>

    metadata, options = get_config()

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

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, 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 /home/andre/.pip/pip.log

My questions. What package should I install to query Mysql databases and how should I install? Pip install should be used in this case?

Give me a clue.

Best regards,


The error message is self-speaking

sh: mysql_config: not found

mysql_config is part of the MySQL installation is either not installed nor not available from the $PATH. This is the problem to be solved - not the question about binding alternatives.


The error message shows you are missing mysql_config (and seem to be on an Ubuntu machine):

EnvironmentError: mysql_config not found
...
sh: mysql_config: not found

dpkg -S can show which package provides mysql_config -- assuming you have a machine with mysql_config installed... :)

% dpkg -S $(which mysql_config)
libmysqlclient-dev: /usr/bin/mysql_config

Therefore, it looks like you need to install the libmysqlclient-dev package.

PS. If you don't have a machine with mysql_config installed, the same info can be found at http://packages.ubuntu.com/.


Have a look at this links: one, two, three The source you can find here

0

精彩评论

暂无评论...
验证码 换一张
取 消