将 Python 与我的框架打包是错误的吗?
事情是这样的。我正在开发一个框架,其唯一用户在他们的服务器(Linux)上安装了Python,结果非常混乱。他们的服务器上都有多个版本的 Python,并且他们的 PYTHONHOME 和 PYTHONPATH 变量指向不同的版本。
由于我的框架需要 Python 2.6,因此我认为分发应用程序的安全方法可能是将预编译版本的 Python 与我的应用程序捆绑在一起。为了测试这个理论,我下载了 ActivePython 并按应用程序捆绑了所有必需的文件。我的主脚本调用#!/vendor/ActivePython2.6/bin/python。
到目前为止,我已经在不同的服务器发行版和不同人的服务器上测试了该框架,到目前为止它似乎没有任何问题。
我的问题是,这样做有什么问题吗?有什么替代方案吗?
Here's the deal. I am developing a framework whose sole users have extremely messed up python installations on their servers (Linux). They all have multiple versions of Python on their servers and their PYTHONHOME and PYTHONPATH variables are pointing to different versions.
Since my framework will require Python 2.6, I thought that a safe way to distribute my application might be to bundle a pre-compiled version of Python with my application. To test this theory out, I downloaded ActivePython and bundled all the necessary files with by application. My main script calls #!/vendor/ActivePython2.6/bin/python.
So far, I have tested the framework on different server distributions and with different people's servers and it seems to have worked so far with no problems (yet).
My question is, are there any problems in doing this and are there any alternatives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议不要这样做。您将遇到 32b 和 64b 版本之间的问题、不同 libc 版本之间的问题、noexec 位置、自定义路径的错误 selinux/apparmor 配置文件以及许多其他潜在问题...
除非您计划发布(并测试!)一个包对于每个单独的发行版、架构和版本,我想说你正在给自己制造问题。当然,另一种选择是提供两个版本 - 仅默认提供框架,并在出现问题时提供静态 python 包。
I'd recommend against it. You'll run into problems between 32b and 64b versions, between different libc versions, noexec locations, wrong selinux/apparmor profiles for custom paths and many other potential problems...
Unless you're planning to release (and test!) a package for each separate distribution, architecture and version, I'd say you're creating problems for yourself. The alternative is to provide both versions of course - provide the framework only by default and make the static python package available in case of problems.