Sublime Text 2 add module for PlugIn (MySQLdb)

被刻印的时光 ゝ 提交于 2019-12-12 14:33:16

问题


Im developing a small plugin for Sublime Text 2, but i need to use MySQLdb module. The MySQLdb module works fine from my normal CLI. But SB2 uses its own version of Python.

Any idea how i can install the MySQKdb module and where so SB2 can find it?

Python installation used /System/Library/Frameworks/Python.framework/Versions/2.7/

Thanks!


回答1:


I was working on a plug-in today, and the solution I chose was to place the module within my package directory. In otherwords:

Packages
|  MyPackage
|  |  MyPackage.py
|  |  MySQLdb
|  |  | contents of MySQLdb package

You can change the PYTHONPATH that Sublime Text 2 uses, per these posts, but it seems there may be compatibility issues if you aren't careful.

Sublime Text 2: custom PATH and PYTHONPATH

Sublime Text2 Import error: No module named Gnuplot

This leads me to believe that the best solution would be to create a folder specifically for downloading modules solely for the use of Sublime Text 2, and adding that to Sublime Text's PYTHONPATH.



来源:https://stackoverflow.com/questions/12863503/sublime-text-2-add-module-for-plugin-mysqldb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!