How to install MySQLdb package? (ImportError: No module named setuptools)

后端 未结 11 1050
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-25 10:20

I am trying to install MySQLdb package. I found the source code here.

I did the following:

gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.         


        
11条回答
  •  醉梦人生
    2020-12-25 11:05

    #!/usr/bin/env python
    
    import os
    import sys
    from **distutils.core** import setup, Extension
    
    if sys.version_info < (2, 3):
        raise Error("Python-2.3 or newer is required")
    
    if os.name == "posix":
        from setup_posix import get_config
    else: # assume windows
        from setup_windows import get_config
    
    metadata, options = get_config()
    metadata['ext_modules'] = [Extension(sources=['_mysql.c'], **options)]
    metadata['long_description'] = metadata['long_description'].replace(r'\n', '')
    setup(**metadata)
    

提交回复
热议问题