Python Forum

Full Version: Can't install MySQLdb/MySQL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Vitals: MacOS, Python 2.7

I've found myself in a catch22. I need to connect to a MySQL database. In order to get MySQL too work with python, I need to get MySQL and the MySQL connector.

In order to get this, I need pip. In order to get pip, I either need to download the source - which fails when i run the .py install - or I need to use easy_install pip.

When I run easy_install, I receive an error (even if im just checking the version).

MyComputer:~ user$ easy_install --version
Traceback (most recent call last):
  File "/usr/bin/easy_install-2.7", line 11, in <module>
    load_entry_point('setuptools==18.5', 'console_scripts', 'easy_install')()
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 484, in load_entry_point
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 2707, in load_entry_point
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 2325, in load
  File "build/bdist.macosx-10.13-intel/egg/pkg_resources/__init__.py", line 2331, in resolve
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 46, in <module>
    from setuptools.archive_util import unpack_archive
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/archive_util.py", line 15, in <module>
    from pkg_resources import ensure_directory, ContextualZipFile
ImportError: cannot import name ContextualZipFile
The suggested fixes I've found suggest opening archive_util.py and removing the "import ContextualZipFile". However, the python that the system is referring to is the copy that came preinstalled on the system. I cannot make changes to this one.

I have another copy under User - its archive_util.py does not import ContextualZipFile.

I attempted to look for a way to use the /user version instead - suggestions were to modify ~/.bash-profile. This did not work.

I've been at this for days and I'm nearly at wits end.