mysql-python

MySQLdb problems in django

。_饼干妹妹 提交于 2019-12-07 10:34:28
I installed mysql-python on 64bit snow leopard,and it's good under python IDE,but failed import in django. Anyone had meet similar question? File "/Library/Python/2.6/site-packages/django/db/backends/mysql/base.py", line 14, in <module> raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/szanlin/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib Referenced from: /Users/szanlin/.python-eggs/MySQL_python-1.2.3-py2.6

MySQL-python, error: command 'gcc-4.2' failed with exit status 1

…衆ロ難τιáo~ 提交于 2019-12-07 10:22:17
问题 I've been looking around for a solution to this, and there seem to be a lot of different solutions, but none seem to be working. I'm using MySQL-Python to try to get MySQL set up with python. But, when I try to run sudo python setup.py build I get the following error: Password: running build running build_py copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb running build_ext building '_mysql' extension gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer

Python MySQLdb converters isn't working

百般思念 提交于 2019-12-07 07:43:07
问题 I'm trying to run an ETL script using python and MySQLdb but I'm stuck with the results from my initial extract query. The types returned are all Long and Decimal when I want Int and Float. I've searched around for a few hours trying to get an answer to this without any success. database = MySQLdb.connect(host='db',user='user', passwd='password', db='db123') database_cursor = database.cursor() database_query = ("SELECT id, siteId, campaignId, hour, sum(impressions) AS impressions, " "sum

No module named MySQLdb even if MySQL-python installed?

狂风中的少年 提交于 2019-12-07 07:11:35
问题 I have a CentOS box. (venv)[root@localhost]# yum install MySQL-python Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * base: mirrors.maine.edu * epel: ftp.osuosl.org * extras: mirror.us.leaseweb.net * remi: rpms.famillecollet.com * updates: mirrors.centarra.com Setting up Install Process Package MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 already installed and latest version Nothing to do ... (venv)[root@localhost]# python Python 2.7.6

Execute .sql file in Python with MySQLdb

坚强是说给别人听的谎言 提交于 2019-12-07 06:04:25
问题 I have a .sql file containing a bunch of SQL queries, with each query spanning multiple lines. I want to execute these queries in MySQL via Python using MySQLdb . sqlite3 has "a nonstandard shortcut" for this purpose called executescript(), but there doesn't seem to be any equivalent function in MySQLdb . I noticed this old question from 2 years ago which asks the same thing, but I found the answers unsatisfying. The answers are basically: Use subprocess to run the mysql command and send it

Fatal error: #include <stdio.h> generated after “pip install mysql-python” command

你离开我真会死。 提交于 2019-12-07 04:51:28
Like many people, I am having issues getting mysql and python to work together. My specs are: OSX10.9.2 Anaconda 1.9.1 with python 2.7.2, although 2.5 and 2.6 appear to be included MySQL 5.6.16 I have written a python script where I try to import MySQLdb, or PyMySQL then MySQLdb, neither works. I read many of the threads on stack overflow, and as a result I eventually tried $ export CFLAGS=-Qunused-arguments $ export CPPFLAGS=-Qunused-arguments $ pip install mysql-python The results are below. A fatal error was issued, as can be seen at the bottom of the output. Downloading/unpacking mysql

Can't import MySQLdb module in Python

前提是你 提交于 2019-12-07 04:11:53
问题 I'm trying to use MySQL in Python. I have installed the MySQL adapter (MySQL-python-1.2.4b4.win32-py2.7) for Python, but when I try to import the MySQLdb module (import MySQLdb) with command prompt I receive the following output: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 19, in <module> import _mysql ImportError: DLL load failed: %1 is not a valid Win32 application. Would anybody know, what could be

Compiling mysql-python on Windows with PIP

房东的猫 提交于 2019-12-06 17:07:59
问题 So I have Python 2.7 and setuptools installed on my Windows 7 laptop. I also have Visual Studio 2008 Express installed and MySQL with dev tools. I am trying to install mysql-python via pip like: pip install mysql-python I am getting link errors: Creating library build\temp.win32-2.7\Release\_mysql.lib and object build\temp.win32-2.7\Release\_mysql.exp _mysql.obj : error LNK2019: unresolved external symbol _mysql_error@4 referenced in function __mysql_Exception _mysql.obj : error LNK2019:

MySQL Connector/python not working in django

送分小仙女□ 提交于 2019-12-06 14:43:43
I'm learning Django with MySQL as backend. I installed Oracle's mysql connector to connect with mysql. However, when I run python manage.py I got this error Traceback (most recent call last): File "C:\Python33\lib\site-packages\django\db\backends\mysql\base.py", line 14, in import MySQLdb as Database ImportError: No module named 'MySQLdb' That's a bit weird. I was thinking if I installed mysql connector/python I dont need MySQLdb anymore. Could anyone help explain? Thanks! My database setting: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': "djangolearn", 'USER': 'root

Can MySQLdb Connection and Cursor objects be safely used from with multiple threads?

南笙酒味 提交于 2019-12-06 13:22:20
I'm using mysqlclient v1.3.10 in Python 3.5. After connecting to the database, you get a connection object, from which you get a cursor object that you use to run your queries. Are these objects thread safe (i.e. can I create one set and then share and use them between multiple different python threads)? It appears that you can't. The MySQLdb documentation states (scroll down a little further to threadsafety ): The general upshot of this is: Don’t share connections between threads. It’s really not worth your effort or mine, and in the end, will probably hurt performance, since the MySQL server