开发者

ImportError with Pylons/SQLAlchemy and MySQL

Firstly, I should say I'm completely new to Pylons, trying to learn web development with Python after coming from a PHP/MySQL background. I've seen similar questions to this problem, but mine is kind of a reverse version.

I've been following the Pylons book (pylonsbook.com) to setup my application and get the following error:

ImportError: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory

Other questions I've seen relate to the user having an older version of libmysqlclient_r.so.15, whereas I seem to have v16 installed.

Any suggestions as to what I can/should do would be greatly appreciated. Entire output is below.

(env)eclipse@eclipse31:/var/www/python/SimpleSite$ paster setup-app development.ini
Running setup_config() from simplesite.websetup
Traceback (most recent call last):
File "/var/www/python/env/bin/paster", line 8, in <module>  
    load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()  
File "/var/www/python/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 84, in run
    invoke(command, command_name, options, args[1:])
File "/var/www/python/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 123, in invoke
    exit_code = runner.run(args)
File "/var/www/python/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 68, in run
    return super(AbstractInstallCommand, self).run(new_args)
File "/var/www/python/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 218, in run
    result = self.command()
File "/var/www/python/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 456, in command
    self, config_file, section, self.sysconfig_install_vars(installer))
File "/var/www/python/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 598, in setup_config
    mod.setup_app, command, filename, section, vars)
File "/var/www/python/env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 612, in _call_setup_app
    func(command, conf, vars)
File "/var/www/python/SimpleSite/simplesite/websetup.py", line 16, in setup_app
    load_environment(conf.global_conf, conf.local_conf)
File "/var/www/python/SimpleSite/simplesite/config/environment.py", line 48, in load_environment
    engine = engine_from_config(config, 'sqlalchemy.')
File "/var/www/python/env/lib/python2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/engine/__init__.py", line 241, in engine_from_config
    return create_engine(url, **opts)
File "/var/www/python/env/lib/python2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/engine/__init__.py", line 223, in create_engine
    return strategy.create(*args, **kwargs)
File "/var/www/python/env/lib/python2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/engine/strategies.py", line 62, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
File "/var/www/python/env/lib/python2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/databases/mysql.py开发者_Python百科", line 1456, in dbapi
    import MySQLdb as mysql
File "/var/www/python/env/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/MySQLdb/__init__.py", line 19, in <module>
    File "/var/www/python/env/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 7, in <module>
File "/var/www/python/env/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg/_mysql.py", line 6, in __bootstrap__
ImportError: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory


Either install the .so.15 version of the library, or find or build MySQLdb against .so.16.


I had the same error, although I was working with Django. I'm using Ubuntu Lucid (10.04) and a solution that worked for me was to delete (or rename) the MySQL_python-1.2.3c1-py2.6-linux-i686.egg directory and install python-mysqldb, if you don't have it yet.

The reason seems to be that MySQL_Python binary egg is linked directly to libmysqlclient_15.so, and this library has been replaced by libmysqlclient_16.so in Lucid.

I had found this solution in: http://github.com/rafpaf/OpenHatch

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜