如何创建一个完全自治的Python环境?
我想在 USB 笔驱动器上创建一个完全自主的 Python 环境,可以在 Windows 和 GNU/Linux 上运行......
我该怎么做?
我尝试使用“./”作为前缀构建Python,但它不起作用......有人有其他想法吗?
提前致谢...
I want to create a completely autonomous Python environment on an USB pen drive that can run both on Windows and GNU/Linux....
How can I do that ?
I've tried to build Python with `./' as prefix, but it doesn't works... anyone has another idea ?
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我看过 http://svn.python.org/projects /python/branches/release31-maint/ 我发现了一个有趣的 «自述文件» 谈论 «pyconfig.h» 文件。
在 http://svn.python.org/projects/ python/branches/release31-maint/PC/pyconfig.h 在第82-83行,有我的问题的解决方案:
我想如果我更改“PYTHONPATH”定义的值,我会得到一个python 解释器在相对目录中寻找他的文件,所以我只需要为 GNU/Linux 和 Window 构建它,并将这两个可执行文件放在笔式驱动器上,然后我将获得一个便携式 Python 环境!
我正在尝试这个,我会随时通知您...
编辑:终于,它起作用了!
我已经像这样构建了Python:
...现在Python在`../lib'中寻找模块!
我将为 GNU/Linux 和 Windows 构建它,并将其放在 USB 笔式驱动器上,如下所示:
谢谢大家
Ok, i've looked at http://svn.python.org/projects/python/branches/release31-maint/ and i found an interesting «readme» talking about a «pyconfig.h» file.
In http://svn.python.org/projects/python/branches/release31-maint/PC/pyconfig.h at line 82-83, there is the solution of my problem:
I think if i change the value of the «PYTHONPATH» define, i'll get a python interpreter seeking his files in a relative directory, so I'll just have to build it both for GNU/Linux and Window, and to put the both executables on a pen-drive, then i'll get a portable Python environment !
I'm trying this, and I'll keep you posted ...
EDIT: Finally, it works !
I've built Python like this:
... and now Python seeks the modules in `../lib' !
I will build it both for GNU/Linux and Windows, and i'll put it on an USB pen-drive, like this:
Thanks all