Errors installing MySQL-python module for Python 2.7

I am currently trying to create and install the mySQLdb module for Python, but the command

python setup.py build

gives me an error

running build running build_py copying MySQLdb/release.py -> build/lib.macosx-10.3-intel-2.7/MySQLdb error: could not delete 'build/lib.macosx-10.3-intel-2.7/MySQLdb/release.py': Permission denied

I confirmed that I am the root user and when I try to execute the script using sudo, I get a gcc-4.0 error:

running build running build_py copying MySQLdb/release.py -> build/lib.macosx-10.3-fat-2.7/MySQLdb running build_ext building '_mysql' extension gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.3-fat-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64 unable to execute gcc-4.0: No such file or directory error: command 'gcc-4.0' failed with exit status 1

Which is strange because I am using Xcode 4 with Python 2.7. I tried the easy_install and pip methods, both of which do not work and give me permission denied for release.py. I chmodded this file to see if it was a problem but no luck. Thoughts?

+4
source share
2 answers

Make sure gcc-4.0 is in PATH . Alternatively, you can create an alias from gcc in gcc-4.0.

Take care of versions 32b and 64b. Mac OS X is a 64-bit operating system, and you should use flags to make sure you compile for 64b architecture.

+1
source

If you are running Windows, you can use the precompiled installer. Check out this page for many of these installers, including MySQLdb for various Python releases.

0
source

Source: https://habr.com/ru/post/1382629/


All Articles