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

后端 未结 6 642
臣服心动
臣服心动 2020-12-08 14:35

I have some .py files I wrote that I want to run on a different machine. The target machine does not have python installed, and I can\'t \'install\' it by policy. What I c

相关标签:
6条回答
  • 2020-12-08 14:42

    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?

    0 讨论(0)
  • 2020-12-08 14:44

    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.

    0 讨论(0)
  • 2020-12-08 14:46

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

    0 讨论(0)
  • 2020-12-08 14:46

    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.

    0 讨论(0)
  • 2020-12-08 14:50

    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

    0 讨论(0)
  • 2020-12-08 14:54

    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.

    0 讨论(0)
提交回复
热议问题