我正试图解决Angstrom上Python的MYSQL连接器的一些依赖关系。
在命令行中,我得到以下错误:
Python 2.6.6 (r266:84292, Feb 25 2011, 16:50:01)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named io我以为IO是一个基本的模块。它似乎是最新的:
# opkg install python-core
Package python-core (2.6.6-ml12.2.6) installed in root is up to date.IO在默认情况下不应该可用,我能做些什么来解决这个问题?
发布于 2014-12-23 12:57:22
感谢Padraic Cunningham带领我找到解决方案的方法。
我发现安装过程中缺少了几个文件,包括io.py。从Angstrom网站构建Beagleboard (XM)映像的Angstrom不包括这些文件(或者我随后做的修改,删除了它们?)。我从Python源代码重新构建了Python,保留了相同的版本。
然后,我必须重新构建MySQL连接器(来自MySql/Oracle)。(我的所有其他模块,包括OpenCV继续工作,没有问题)
这起作用了,我现在可以查询数据库了。
再加一个音符。一旦解决了所有依赖项,我仍然无法连接到数据库。问题是,MySQL连接器假定的是TCP/IP连接,而不是基于文件的套接字。因此,我不得不在连接字符串中添加以下内容:
unix_socket="/tmp/mysql.sock"使得完整连接字符串如下所示:
cnx = mysql.connector.connect(user='username', password='password', host='localhost', database='dbname', raise_on_warnings=True, unix_socket="/tmp/mysql.sock")https://stackoverflow.com/questions/27595198
复制相似问题