安装两个同名的python模块 [英] Install two python modules with same name

查看:144
本文介绍了安装两个同名的python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装两个具有相同名称的python模块的最佳方法是什么?我目前依赖两个不同的Facebook库:pyfacebook和Facebook的新python-sdk。这两个库都将自己安装为 facebook模块。我可以想到很多hacky解决方案,但是在我被黑客入侵之前,我很好奇是否有Python方式可以处理这种情况。

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 situation.

我正在使用virtualenv和pip。

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.

要支持这种类型的事情,请将每个模块放在其自己的文件夹中,并放入一个 __ init __。py 文件,然后可以执行以下操作:

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

这篇关于安装两个同名的python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆