I get the following error when I try to install MySQL-python-1.2.3 under Python 2.6 in Fedora 14.
Fedora 14 comes with Python 2.7 by default and I am working in a project which runs in Python 2.6, So I am not in a position to update Python from 2.6 to 2.7.
_mysql.c:35:23: fatal error: my_config.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
The complete error message is as below
[root#localhost MySQL-python-1.2.2]# python setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.6
copying _mysql_exceptions.py -> build/lib.linux-i686-2.6
creating build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.6/MySQLdb
creating build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.6
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/include/mysql -I/usr/local/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
_mysql.c:35:23: fatal error: my_config.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
[root#localhost MySQL-python-1.2.2]# python2.6 setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.6/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/include/mysql -I/usr/local/include/python2.6 -c _mysql.c -o build/temp.linux-i686-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
_mysql.c:35:23: fatal error: my_config.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
you need to install MySQL Development package
yum install mysql-devel
Install python-devel. That should help
Solved this issue in the following way
Copy MySQLdb folder from site-packages directory of Python2.7 to Python2.6.
Also copy the following files from site-packages directory of Python2.7 to Python2.6.
_mysql.so
_mysql_exceptions.py
_mysql_exceptions.pyc
_mysql_exceptions.pyo
Now try the following
>>> import MySQLdb
>>> MySQLdb.__version__
'1.2.3'
Related
I want to install the MySQLclient package on my Cpanel host through the terminal. Because I want to connect my Django project to the database.
When I want to install the necessary packages, everyone installs except MySQLClient.
It also gives an error:
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [43 lines of output]
mysql_config --version
/bin/mysql_config: line 8: rpm: command not found
['8.0.28']
mysql_config --libs
/bin/mysql_config: line 8: rpm: command not found
['-L/usr/lib64/mysql', '-lmysqlclient', '-lpthread', '-ldl', '-lssl', '-lcrypto', '-lresolv', '-lm', '-lrt']
mysql_config --cflags
/bin/mysql_config: line 8: rpm: command not found
['-I/usr/include/mysql', '-m64']
ext_options:
library_dirs: ['/usr/lib64/mysql']
libraries: ['mysqlclient', 'pthread', 'dl', 'resolv', 'm', 'rt']
extra_compile_args: ['-std=c99', '-m64']
extra_link_args: []
include_dirs: ['/usr/include/mysql']
extra_objects: []
define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.8/MySQLdb
creating build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/MySQLdb
/opt/rh/devtoolset-7/root/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fPIC -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/include/mysql -I/home/hrarshai/virtualenv/filmopia_site/3.8/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.8/MySQLdb/_mysql.o -std=c99 -m64
error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
error: subprocess-exited-with-error
× Running setup.py install for mysqlclient did not run successfully.
│ exit code: 1
╰─> [45 lines of output]
mysql_config --version
/bin/mysql_config: line 8: rpm: command not found
['8.0.28']
mysql_config --libs
/bin/mysql_config: line 8: rpm: command not found
['-L/usr/lib64/mysql', '-lmysqlclient', '-lpthread', '-ldl', '-lssl', '-lcrypto', '-lresolv', '-lm', '-lrt']
mysql_config --cflags
/bin/mysql_config: line 8: rpm: command not found
['-I/usr/include/mysql', '-m64']
ext_options:
library_dirs: ['/usr/lib64/mysql']
libraries: ['mysqlclient', 'pthread', 'dl', 'resolv', 'm', 'rt']
extra_compile_args: ['-std=c99', '-m64']
extra_link_args: []
include_dirs: ['/usr/include/mysql']
extra_objects: []
define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')]
running install
/home/hrarshai/virtualenv/filmopia_site/3.8/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.8/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.8/MySQLdb
creating build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.8/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/MySQLdb
/opt/rh/devtoolset-7/root/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fPIC -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/include/mysql -I/home/hrarshai/virtualenv/filmopia_site/3.8/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.8/MySQLdb/_mysql.o -std=c99 -m64
error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mysqlclient
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I do not understand this error and I do not know what it says.
No matter how much I searched, I did not find anything useful.
Thank you for your help.
I got the following types of error while installing mysqlclient
error: subprocess-exited-with-error (Running setup.py install for
mysqlclient did not run successfully)
Python Error: Command 'X86_64-Linux-Gnu-Gcc' Failed With Exit Status 1 With Code Examples
Let's solve this problem using the following commands:
sudo apt-get install gcc python3.x-dev # choose correct python version
sudo apt-get install libxml2-dev libxslt1-dev
This solution worked for me and you can at least try it. I hope it helps.
Thank you!
I found out that the host I was trying to install MySQLclient on had to be configured by the provider for Python 3.9
But because I was in a hurry and could not wait for the host to be configured, I ran the project on Python 3.7 and no problem occurred.
I am trying to install mysqlclient using pip install mysqlclient but it's showing the following error:
pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-haimRr/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpnpNImepip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c: In function ‘_mysql_field_to_python’:
MySQLdb/_mysql.c:1145:33: warning: passing argument 1 of ‘PyInt_FromString’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
return PyInt_FromString(rowitem, NULL, 10);
^~~~~~~
In file included from /usr/include/python2.7/Python.h:89:0,
from MySQLdb/_mysql.c:38:
/usr/include/python2.7/intobject.h:37:24: note: expected ‘char *’ but argument is of type ‘const char *’
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
^~~~~~~~~~~~~~~~
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/MySQLdb/_mysql.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-haimRr/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Z3t7oY-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/usr/include/python2.7 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o
MySQLdb/_mysql.c: In function ‘_mysql_field_to_python’:
MySQLdb/_mysql.c:1145:33: warning: passing argument 1 of ‘PyInt_FromString’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
return PyInt_FromString(rowitem, NULL, 10);
^~~~~~~
In file included from /usr/include/python2.7/Python.h:89:0,
from MySQLdb/_mysql.c:38:
/usr/include/python2.7/intobject.h:37:24: note: expected ‘char *’ but argument is of type ‘const char *’
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
^~~~~~~~~~~~~~~~
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/MySQLdb/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-2.7/MySQLdb/_mysql.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-haimRr/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Z3t7oY-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-haimRr/mysqlclient/
How can I fix this error ?
The error is saying that you miss lssl and lcrypto.
To solve you need to install libssl-dev.
I'm on a Macbook running MacOS High Sierra (Version 10.13.4)
I'm running a virtual environment.
Inside the virtual environment, I'm doing a pip install MySQL-python. But its failing with the C compile error shown below.
What's the reason for this error and how can I fix it?
$ pip install MySQL-python==1.2.5
Collecting MySQL-python==1.2.5
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
Running setup.py bdist_wheel for MySQL-python ... error
Complete output from command /Users/saqib.ali/saqib_bnet_docs/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-install-KM5pDI/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-wheel-qP6Us6 --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.13-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.13-intel-2.7
creating build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb
creating build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.13-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.13-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/opt/openssl/include -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mariadb/10.3.10/include/mysql -I/usr/local/Cellar/mariadb/10.3.10/include/mysql/.. -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.13-intel-2.7/_mysql.o
In file included from _mysql.c:44:
/usr/local/Cellar/mariadb/10.3.10/include/mysql/my_config.h:3:2: warning: This file should not be included by clients, include only <mysql.h> [-W#warnings]
#warning This file should not be included by clients, include only <mysql.h>
^
<WARNINGS SNIPPED FOR BREVITY>
_mysql.c:2005:42: error: no member named 'reconnect' in 'struct st_mysql'
if ( reconnect != -1 ) self->connection.reconnect = reconnect;
~~~~~~~~~~~~~~~~ ^
16 warnings and 1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Failed building wheel for MySQL-python
I have cut out some of the warnings for brevity. You can see the full output here.
It looks like it's picking up the header from an incompatible installation of mariadb.
You probably need to install mysql and/or mysqlclient.
see for details:
Install mysqlclient for Django Python on Mac OS X Sierra
I am trying to create a binary from a python,flask and boto3 app. I am having trouble running the pip install cx_Freeze command too work. I am getting the following error :
It seems to be not fetching the right system libraries. Also, can anyone suggest any tools to package python apps into binaries?
Failed building wheel for cx-Freeze
Running setup.py clean for cx-Freeze
Failed to build cx-Freeze
Installing collected packages: cx-Freeze
Running setup.py install for cx-Freeze ... error
Complete output from command /home/shaswat.g/.virtualenvs/flask_app/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yLvkz9/cx-Freeze/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-kKRaSM-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/shaswat.g/.virtualenvs/flask_app/include/site/python2.7/cx-Freeze:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/dist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/main.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/common.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/__init__.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/macdist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/finder.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/setupwriter.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/windist.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/hooks.py -> build/lib.linux-x86_64-2.7/cx_Freeze
copying cx_Freeze/freezer.py -> build/lib.linux-x86_64-2.7/cx_Freeze
creating build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLibSource.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/__startup__.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLib.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/ConsoleSetLibPath.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
copying cx_Freeze/initscripts/Console.py -> build/lib.linux-x86_64-2.7/cx_Freeze/initscripts
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
copying cx_Freeze/samples/relimport/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
copying cx_Freeze/samples/relimport/relimport.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/relimport
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/Config.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
copying cx_Freeze/samples/service/ServiceHandler.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/service
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
copying cx_Freeze/samples/openpyxl/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
copying cx_Freeze/samples/openpyxl/test_openpyxl.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/openpyxl
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
copying cx_Freeze/samples/simple/hello.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
copying cx_Freeze/samples/simple/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/simple
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
copying cx_Freeze/samples/matplotlib/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/matplotlib
copying cx_Freeze/samples/matplotlib/matplotlib_eg.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/ matplotlib
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
copying cx_Freeze/samples/PyQt4/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
copying cx_Freeze/samples/PyQt4/PyQt4app.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/PyQt4
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/advanced_1.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/advanced_2.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
copying cx_Freeze/samples/advanced/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/advanced
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
copying cx_Freeze/samples/asmodule/asmodule.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
copying cx_Freeze/samples/asmodule/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/asmodule
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
copying cx_Freeze/samples/zope/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
copying cx_Freeze/samples/zope/qotd.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/zope
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
copying cx_Freeze/samples/Tkinter/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
copying cx_Freeze/samples/Tkinter/SimpleTkApp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/Tkinter
creating build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
copying cx_Freeze/samples/wx/setup.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
copying cx_Freeze/samples/wx/wxapp.py -> build/lib.linux-x86_64-2.7/cx_Freeze/samples/wx
running build_ext
building 'cx_Freeze.util' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/source
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/util.c -o build/temp.linux-x86_64-2.7/source/util.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/ python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/source/util.o -o build/ lib.linux-x86_64-2.7/cx_Freeze/util.so
creating build/temp.linux-x86_64-2.7/source/bases
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/bases/ Console.c -o build/temp.linux-x86_64-2.7/source/bases/Console.o
creating build/lib.linux-x86_64-2.7/cx_Freeze/bases
x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64-2.7/source/bases/Console.o -L/usr/lib/python2.7/ config-x86_64-linux-gnu -lpython2.7 -o build/lib.linux-x86_64-2.7/cx_Freeze/bases/Console -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -lpthread -ldl -lutil -lm -L/usr/lib -lz -s
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/shaswat.g/.virtualenvs/flask_app/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yLvkz9/cx-Freeze/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-kKRaSM-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/shaswat.g/.virtualenvs/flask_app/include/site/python2.7/cx-Freeze" failed with error code 1 in /tmp/pip-build-yLvkz9/cx-Freeze/
Just do
sudo apt install zlib1g-dev
I was trying to install cx-freeze to convert some python code to an exe but the problem was /usr/bin/ld: cannot find -lz just like you. The file being fetched is compressed (cx_Freeze-5.1.1.tar.gz) so you need zlib. Of course use pip3 for python3.
pip never installs system libraries, it only concerns itself with Python libs.
It seems you need to install zlib before installing cx_Freeze.
Another tool to generate binaries is PyInstaller.
This solution works for me on centos8
yum install gcc
yum install python3-devel
pip install wheel
pip install importlib-metadata
pip install patchelf
pip3 install cx-Freeze
Django documentation as of v1.8 recommends using mysqlclient connector for the framework. I'm attempting to pip install the package on Ubuntu 14.04 with Python 3.4 and running into a GCC error that I'm unable to find reference to. I'm not an expert on compiling software, so was hoping somebody can see the solution.
I believe I'm getting a linking error. I have installed distro specific mysql headers, but it looked like they were only applicable to Python 2.7.x.
Not sure how much of this is useful so apologies for the long paste, but here's the error log:
Using version 1.3.6 (newest of versions: 1.3.6, 1.3.5, 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0)
Downloading from URL https://pypi.python.org/packages/source/m/mysqlclient/mysqlclient-1.3.6.tar.gz#md5=58d7c9c617a4286a88db290e7857d3aa (from https://pypi.python.org/simple/mysqlclient/)
Running setup.py (path:/tmp/pycharm-packaging4.tmp/mysqlclient/setup.py) egg_info for package mysqlclient
running egg_info
creating pip-egg-info/mysqlclient.egg-info
writing dependency_links to pip-egg-info/mysqlclient.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/mysqlclient.egg-info/top_level.txt
writing pip-egg-info/mysqlclient.egg-info/PKG-INFO
writing manifest file 'pip-egg-info/mysqlclient.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/mysqlclient.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pip-egg-info/mysqlclient.egg-info/SOURCES.txt'
Source in /tmp/pycharm-packaging4.tmp/mysqlclient has version 1.3.6, which satisfies requirement mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient
Running command /home/tim/BingVEnv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pycharm-packaging4.tmp/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-4bp9npvl-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/tim/BingVEnv/include/site/python3.4
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.4/MySQLdb
creating build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.4
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,6,'final',1) -D__version__=1.3.6 -I/usr/include/mysql -I/home/tim/BingVEnv/include -I/usr/include/python3.4m -c _mysql.c -o build/temp.linux-x86_64-3.4/_mysql.o -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/_mysql.o -lmysqlclient -lpthread -lz -lm -ldl -o build/lib.linux-x86_64-3.4/_mysql.cpython-34m.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /home/tim/BingVEnv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pycharm-packaging4.tmp/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-4bp9npvl-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/tim/BingVEnv/include/site/python3.4:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.4/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.4/MySQLdb
creating build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.4/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.4
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,6,'final',1) -D__version__=1.3.6 -I/usr/include/mysql -I/home/tim/BingVEnv/include -I/usr/include/python3.4m -c _mysql.c -o build/temp.linux-x86_64-3.4/_mysql.o -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/_mysql.o -lmysqlclient -lpthread -lz -lm -ldl -o build/lib.linux-x86_64-3.4/_mysql.cpython-34m.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
It looks like you're missing zlib; you'll want to install it: apt-get install zlib1g-dev
I also suggest reading over the README and confirming you have all other dependencies met: https://github.com/dccmx/mysqldb/blob/master/README
Also, I suggest using mysqlclient over MySQLdb as its a fork of MySQLdb and what Django recommends.
using this MySQL Connector worked for me:
https://dev.mysql.com/downloads/connector/python/
https://dev.mysql.com/doc/connector-python/en/connector-python-installation.html
http://dev.mysql.com/doc/connector-python/en/connector-python-django-backend.html