import MySQLdb UserWarning

Finished processing dependencies for MySQL-python==1.2.5
╭─haoke@haokedeMBP ~/ProgramFiles/MySQL-python-1.2.5
╰─$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/Library/Python/2.7/site-packages/MySQL_python-1.2.5-py2.7-macosx-10.10-intel.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /Library/Python/2.7/site-packages/MySQL_python-1.2.5-py2.7-macosx-10.10-intel.egg/_mysql.pyc, but /Users/haoke/ProgramFiles/MySQL-python-1.2.5 is being added to sys.path

>>> exit();


原因是。install后MySQLdb模块已经被放到python的site-pachages文件夹中;但我在当前文件夹也存在同样的模块,所以可能会反复导入。

仅仅要切换到其它文件夹执行就能够了。

原文地址:https://www.cnblogs.com/gccbuaa/p/6728757.html