在标题中获取错误
OSX Yosemite 10.10.5(14F27) python 2.7
mysql / Applications / XAMPP / xamppfiles / bin的路径
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/XAMPP/xamppfiles/bin
echo $PYTHONPATH
:/Library/Python/2.7/site-packages/
pip list
mysql-connector-python (2.0.4)
mysql-connector-python-cext (2.1.3)
import mysql.connector
cnx = mysql.connector.connect(user='user', password='password', host='127.0.0.1', database='database')
cnx.close()
File "/Volumes/docs/python/TwtWth/mysql.py", line 7, in <module>
import mysql.connector
ImportError: No module named connector
import sys
sys.path.insert(0, '/Library/Python/2.7/site-packages/mysql/connector')
print "\n".join(sys.path)
import mysql.connector
ImportError: No module named connector
有没有人知道任何进一步挖掘的步骤?
答案 0 :(得分:0)
您是否在检查以确保您的点子包已包含在$PYTHONPATH
?
可能需要检查