Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python rdbms API不可用,因为无法加载MySQLdb库_Python_Mysql_Google App Engine_Mysql Python - Fatal编程技术网

Python rdbms API不可用,因为无法加载MySQLdb库

Python rdbms API不可用,因为无法加载MySQLdb库,python,mysql,google-app-engine,mysql-python,Python,Mysql,Google App Engine,Mysql Python,我尝试用本地Mysql调试google app engine应用程序,因为经过一些编码后,然后将其部署到google app engine,访问网站,然后从app engine控制台的日志中查看日志,这需要花费大量时间,而且不方便。但是在我安装了Mysql和Mysql python之后,总是有一个问题,我检查了一下互联网,有很多老帖子在讨论类似的问题,但是没有一个能解决我的问题 我的开发环境: Mac 10.7.3, App-Engine 1.6.4, Python 2.7.1, Mysql

我尝试用本地Mysql调试google app engine应用程序,因为经过一些编码后,然后将其部署到google app engine,访问网站,然后从app engine控制台的日志中查看日志,这需要花费大量时间,而且不方便。但是在我安装了Mysql和Mysql python之后,总是有一个问题,我检查了一下互联网,有很多老帖子在讨论类似的问题,但是没有一个能解决我的问题

我的开发环境:

 Mac 10.7.3, App-Engine 1.6.4, Python 2.7.1,  Mysql  5.5.23 
启动app engine开发服务器并记录:

INFO     2012-04-18 08:45:36,212 py_zipimport.py:148] zipimporter('/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg', 'MySQLdb/')
WARNING  2012-04-18 08:45:36,350 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.

INFO     2012-04-18 08:45:36,484 appengine_rpc.py:160] Server: appengine.google.com
INFO     2012-04-18 08:45:36,488 appcfg.py:582] Checking for updates to the SDK.
DEBUG    2012-04-18 08:45:36,490 appengine_rpc.py:365] Sending HTTPS request:
POST /api/updatecheck?release=1.6.4&timestamp=1330713524&runtime=python27&api_versions=%5B%271%27%5D HTTPS/1.1
Host: appengine.google.com
X-appcfg-api-version: 1
Content-type: application/octet-stream
User-agent: appcfg_py/1.6.4 Darwin/11.3.0 Python/2.7.1.final.0


INFO     2012-04-18 08:45:38,001 appcfg.py:616] This SDK release is newer than the advertised release.
INFO     2012-04-18 08:45:38,075 dev_appserver_multiprocess.py:647] Running application dev~myapp on port 8080: http://localhost:8080
INFO     2012-04-18 08:45:38,076 dev_appserver_multiprocess.py:649] Admin console is available at: http://localhost:8080/_ah/admin
访问并记录:

DEBUG    2012-04-18 08:48:19,608 dev_appserver.py:656] Matched "/" to CGI dispatcher with path main.app
DEBUG    2012-04-18 08:48:19,622 dev_appserver.py:1624] Executing CGI with env:
{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_CONNECTION': 'keep-alive', '_AH_THREADSAFE': '1', 'REQUEST_ID_HASH': 'B6589FC6', 'CURRENT_VERSION_ID': '1.1', 'SERVER_SOFTWARE': 'Development/1.0', 'SCRIPT_NAME': '', 'USER_ORGANIZATION': '', 'REQUEST_METHOD': 'GET', 'HTTP_HOST': 'localhost:8080', 'PATH_INFO': '/', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUERY_STRING': '', 'TZ': 'UTC', 'USER_EMAIL': '', 'CONTENT_LENGTH': '', 'USER_ID': '', 'APPENGINE_RUNTIME': 'python27', 'APPLICATION_ID': 'dev~myapp', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3', 'SERVER_NAME': 'localhost', 'REMOTE_ADDR': '127.0.0.1', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT_LANGUAGE': 'en-us', 'SDK_VERSION': '1.6.4', 'PATH_TRANSLATED': '/Users/Dajie/Workspace/Python/myapp/main.app', 'SERVER_PORT': '8080', '_AH_ENCODED_SCRIPT_NAME': '/', 'AUTH_DOMAIN': 'gmail.com'}
WARNING  2012-04-18 08:48:19,625 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg'
WARNING  2012-04-18 08:48:19,626 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/WebOb-1.2b3-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/WebOb-1.2b3-py2.7.egg'
ERROR    2012-04-18 08:48:19,863 wsgi.py:189] 
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 187, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 225, in _LoadHandler
    handler = __import__(path[0])
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1850, in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1722, in FindAndLoadModule
    description)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1665, in LoadModuleRestricted
    description)
  File "/Users/Dajie/Workspace/Python/myapp/main.py", line 22, in <module>
    import MySQLdb
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1850, in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1722, in FindAndLoadModule
    description)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
    return func(self, *args, **kwargs)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1647, in LoadModuleRestricted
    return source_file.load_module(submodule_fullname)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist/py_zipimport.py", line 246, in load_module
    submodname, is_package, fullpath, source = self._get_source(fullmodname)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist/py_zipimport.py", line 207, in _get_source
    source = self.zipfile.read(relpath.replace(os.sep, '/'))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 867, in read
    return self.open(name, "r", pwd).read()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 882, in open
    zef_file = open(self.filename, 'rb')
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 592, in __init__
    raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg'
INFO     2012-04-18 08:48:19,882 dev_appserver.py:2884] "GET / HTTP/1.1" 500 -
DEBUG 2012-04-18 08:48:19608 dev_appserver.py:656]与路径main.app的CGI dispatcher匹配“/”
调试2012-04-18 08:48:19622 dev_appserver.py:1624]使用env执行CGI:
{'HTTP_-ACCEPT':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8','HTTP_-CONNECTION':'keep-alive','u-ahu-THREADSAFE':'1','REQUEST_-ID_-HASH':'B6589FC6','CURRENT_-VERSION_-ID':'1.1','SERVER_-SOFTWARE':'Development/1.0','SCRIPT u-NAME','USER_-ORGANIZATION':'','s','USER_-ORGANIZATION':'s','s','s','REQUEST_-METHOD'GET','HTTP_-HOST“/”,“服务器协议”:“HTTP/1.0”,“查询字符串”:“TZ”:“UTC”,“用户电子邮件”:“内容长度”:“用户ID”:“APPENGINE_运行时”:“python27”,“应用程序ID”:“dev~myapp”,“HTTP_用户代理”:“Mozilla/5.0(Macintosh;英特尔Mac OS X 10_7_3)AppleWebKit/534.55.3(KHTML,如Gecko)版本/5.1.5 Safari/534.55.3”,“服务器名称”:“本地主机”,“远程地址”:“127.0.0.1”,“内容类型”:“应用程序/x-www-form-urlencoded”,“网关接口”:“CGI/1.1”,“HTTP_接受语言”:“en-us”,“SDK版本”:“1.6.4”,“路径翻译”:“/Users/Dajie/Workspace/Python/myapp/main.app”,“服务器端口”:“8080”,“u-AH-ENCODED”脚本名称”:/“,'AUTH_DOMAIN':'gmail.com'}
警告2012-04-18 08:48:19625 py_zipimport.py:139]无法打开zipfile/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg:IOError:[Errno 13]文件不可访问:'/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg'
警告2012-04-18 08:48:19626 py_zipimport.py:139]无法打开zipfile/Library/Python/2.7/site-packages/WebOb-1.2b3-py2.7.egg:IOError:[Errno 13]文件不可访问:'/Library/Python/2.7/site-packages/WebOb-1.2b3-py2.7.egg'
错误2012-04-18 08:48:19863 wsgi.py:189]
回溯(最近一次呼叫最后一次):
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/runtime/wsgi.py”,第187行,在句柄中
handler=\u config\u handle.add\u wsgi\u中间件(self.\u LoadHandler())
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/runtime/wsgi.py”,第225行,在LoadHandler中
处理程序=\uuuu导入\uuuu(路径[0])
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第676行
返回函数(self、*args、**kwargs)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第1850行,在加载模块中
返回self.findLoadModule(子模块、全名、搜索路径)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第676行
返回函数(self、*args、**kwargs)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第1722行,位于FindLoadModule中
(说明)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第676行
返回函数(self、*args、**kwargs)
LoadModuleRequired中的文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine/google/appengine/tools/dev_appserver\u import\u hook.py”第1665行
(说明)
文件“/Users/Dajie/Workspace/Python/myapp/main.py”,第22行,在
导入MySQLdb
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第676行
返回函数(self、*args、**kwargs)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第1850行,在加载模块中
返回self.findLoadModule(子模块、全名、搜索路径)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第676行
返回函数(self、*args、**kwargs)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第1722行,位于FindLoadModule中
(说明)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第676行
返回函数(self、*args、**kwargs)
文件“/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine default.bundle/Contents/Resources/google\u appengine/google/appengine/tools/dev\u appserver\u import\u hook.py”,第1647行,在LoadModule中
ImportError: dlopen(/Users/Dajie/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/Dajie/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so
  Reason: image not found
$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib