0

I am following https://www.tutorialspoint.com/python/python_database_access.htm to connect Python with SQL.

gunzip MySQL-python-1.2.2.tar.gz
tar -xvf MySQL-python-1.2.2.tar
cd MySQL-python-1.2.2
python setup.py build
python setup.py install

The last command "python setup.py install" gives :

error: [Errno 13] Permission denied: '/anaconda/lib/python2.7/site-packages/easy-install.pth'

Ancalagon BerenLuthien
  • 1,154
  • 6
  • 20
  • 29

1 Answers1

1

Using Anaconda, you should use conda install <package-name>

Linux / Windows: conda install mysql-python

Mac OS: conda install --channel https://conda.anaconda.org/coursera mysql-python

Then it will check for dependencies and install them for you.

ode2k
  • 2,653
  • 13
  • 20
  • Does not work. conda install mysql-python Using Anaconda Cloud api site https://api.anaconda.org Fetching package metadata: .... Solving package specifications: . Error: Package missing in current osx-64 channels: - mysql-python – Ancalagon BerenLuthien Sep 14 '16 at 20:49
  • OK. That was the Linux version. I'll get the OSX setup for you. – ode2k Sep 14 '16 at 20:50
  • Updated with Mac OS instructions. Verified working in Python 2.7 Anaconda – ode2k Sep 14 '16 at 21:00
  • Uprooted but not verified. Thanks a lot. I trust your solution is right, but it did not work for me. I can install it now with OSX terminal, but cannot import it in Python. ERROR MESSAGE: import MySQLdb Traceback (most recent call last): File "", line 1, in File "//anaconda/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in import _mysql ImportError: dlopen(//anaconda/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libssl.1.0.0.dylib Referenced from: //anaconda/lib/python2.7/site-packages/_mysql.so Reason: image not found – Ancalagon BerenLuthien Sep 15 '16 at 23:12
  • Looks like an openssl error now. Try the following links that seem to address this part of the problem. http://stackoverflow.com/a/19172859/3006366 and http://stackoverflow.com/a/20946142/3006366 (Both separate answers to the same post) – ode2k Sep 16 '16 at 00:07