➜  ~ git:(master) ✗ sudo easy_install MySQL-python
[sudo] password for phan: 
Searching for MySQL-python
Reading https://pypi.python.org/simple/MySQL-python/
Best match: MySQL-python 1.2.5
Downloading https://pypi.python.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c
Processing MySQL-python-1.2.5.zip
Writing /tmp/easy_install-oRVY0O/MySQL-python-1.2.5/setup.cfg
Running MySQL-python-1.2.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-oRVY0O/MySQL-python-1.2.5/egg-dist-tmp-tj3z87
sh: 1: mysql_config: not found
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('setuptools==20.7.0', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2293, in main
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 414, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 663, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 693, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 873, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1101, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1087, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 246, in run_setup
    raise
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 243, in run_setup
    DirectorySandbox(setup_dir).run(runner)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 273, in run
    return func()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 242, in runner
    _execfile(setup_script, ns)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 46, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-oRVY0O/MySQL-python-1.2.5/setup.py", line 17, in <module>
  File "/tmp/easy_install-oRVY0O/MySQL-python-1.2.5/setup_posix.py", line 43, in get_config
  File "/tmp/easy_install-oRVY0O/MySQL-python-1.2.5/setup_posix.py", line 25, in mysql_config
EnvironmentError: mysql_config not found

度娘后,安装了libmysqlclient-dev解决

➜  ~ git:(master) ✗ sudo apt-get install libmysqlclient-dev

安装MySQL-python搞定

➜  ~ git:(master) ✗ sudo easy_install MySQL-python         
Searching for MySQL-python
Reading https://pypi.python.org/simple/MySQL-python/
Best match: MySQL-python 1.2.5
Downloading https://pypi.python.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c
Processing MySQL-python-1.2.5.zip
Writing /tmp/easy_install-RxRikL/MySQL-python-1.2.5/setup.cfg
Running MySQL-python-1.2.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-RxRikL/MySQL-python-1.2.5/egg-dist-tmp-oH_bfi
zip_safe flag not set; analyzing archive contents...
Moving MySQL_python-1.2.5-py2.7-linux-x86_64.egg to /usr/local/lib/python2.7/dist-packages
Adding MySQL-python 1.2.5 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg
Processing dependencies for MySQL-python
Finished processing dependencies for MySQL-python
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐