python Egg开发环境搭建

发布于 2024-08-23 03:14:52 字数 505 浏览 11 评论 0原文

我继承了一个python项目,已经打包成egg了。通过 SVN 检查后,我看到包内容为:

__init__.py
scripts/
ptools/
setup.py
...

这里,ptools/ 保存了各种模块的源代码。 scripts/ 是一堆最终用户工具,它们使用“ptools”提供的模块。该软件包已通过“easy_install”安装在这个共享主机环境上,但我想修改scripts/和ptools/并测试它们,而不必经历会影响每个人的“鸡蛋,然后easy_install”的循环别的。

但是,我不知道如何在通过我的开发树调用时进行环境更改以制作脚本/不搜索默认 .egg,而不是使用 ptools/ 中的“本地”模块...有什么想法吗?

更新:我应该补充一点,我尝试了 PYTHONPATH 方法,将模块路径放在开发树中,但后来我尝试通过“import sys; print sys.path”进行验证,模块搜索路径没有变化,这让我感到困惑。

谢谢

奥利弗

I inherited a python project, which has been packaged as egg. Upon check out through SVN, I am seeing package content as:

__init__.py
scripts/
ptools/
setup.py
...

Here, ptools/ hold the source of various modules. scripts/ is bunch of end-user tools that make use of modules provided by the "ptools". The package has been installed on this shared host environment through "easy_install", but I want to modify both scripts/ and ptools/ and test them out without having to go through the cycle of "make an egg, and easy_install" that will affect everyone else.

However, I am lost on how to make environment changes to make scripts/ not to search default .egg when invoking through my development tree, instead of using the "local" modules in ptools/ ... any ideas?

Update: I should have added that I tried PYTHONPATH approach by putting the module path in dev tree there, but then I tried verify through "import sys; print sys.path", there is no change in module search path, which baffles me.

thanks

Oliver

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

救星 2024-08-30 03:14:52

我想我已经找到了问题的解决方案,并且在下面的帖子中得到了解答。 “setup.pydevelop”似乎是完美的解决方案

PYTHONPATH 与 sys.path

I think I have found the solution to my problem, and this has been answered in the following post. "setup.py develop" seems to be the perfect solution

PYTHONPATH vs. sys.path

爱你是孤单的心事 2024-08-30 03:14:52

您可以使用 PYTHONPATH 环境变量来自定义 Python 搜索模块的位置。

You can use the PYTHONPATH environment variable to customize the locations Python searches for modules.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文