开发者

Install two python modules with same name

What's the best way to install two python modules with the same name? I currently depend on two different facebook libraries: pyfacebook and Facebook's new python-sdk. Both of these libraries install themselves as the module 'facebook'. I can think of a bunch of hacky solutions but before I go an hack away I was curious if there was a pythonic way of dealing with this开发者_Go百科 situation.

I'm using virtualenv and pip.

(Yes, I will eventually deprecate one of them, but I had two different engineers working on two different problems and they didn't realize that they were using a different module until integration)


First, I'd suggest you guys go over what other libraries you're all using so you can get a concesus on how you're building your application.

To support this type of thing place each module within it's own folder, put in an __init__.py file, then you can do this:

import Folder1.facebook as pyfacebook
import Folder2.facebook as facebooksdk


The easiest solution would be to include one (or both) of the modules in your project instead of installing it. Then, you can have more control over the module name and importing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜