python: Can I run a python script without actually installing python?

帅比萌擦擦* 提交于 2019-11-28 06:48:45
ccwhite1

I decided to go with cx_Freeze.

It created a distro that I was able to simply copy and move to the target machine. Also, it was much easier to use than py2exe; further it seems that it is still being maintained (as of Mar 10, 2011), while py2exe development does not look as active.

Edit: Development of Portable Python has stopped. I will remove this answer shortly.

Check out Portable Python. That should do what you need.

Current versions (as of April 2015) are 2.7.6 and 3.2.5

nitrogenycs

Check out PyInstaller. It's easier to work with than py2exe (at least for simple applications).

This is an old question, but one alternative is creating a virtual environment for Python, which can be as simple as python -m venv myenvname (Python 3.4). You can "install" packages into it the normal way (e.g. pip) without needing anything else. You'll end up with a folder you can move/delete at your leisure.

It seems virtualenv does not let you easily relocate the virtual environment folder created.

Check virtualenv User Guide. So moving the folder elsewhere may not work. Have you tried the relocate option with virtualenv?

WinPython might be what you need. It needs to be unpacked using an installer, but the unpacked files can be run out of the box on any machine without any installation.

As of October 2015 it's being actively maintained.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!