如何在不安装任何东西的情况下在另一台计算机上运行 Python 项目? [英] How can I run a Python project on another computer without installing anything on it?

查看:71
本文介绍了如何在不安装任何东西的情况下在另一台计算机上运行 Python 项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Python 项目,它有一堆依赖项(在我的 VirtualEnv 中).我需要在我的学校计算机上运行我的项目以进行演示.我的学校计算机没有安装 python,假设也没有 Internet 连接来安装它.我是用Windows 10编写的程序,学校电脑运行的是Windows 7.

I have a Python Project that has a bunch of dependencies (in my VirtualEnv). I need to run my project in my school computer for Demonstration. My School computer does not have python installed, and lets assume also wont have an Internet connection to install it. I have written the program in Windows 10, and the school computer runs Windows 7.

到目前为止,我已经研究了这些解决方案,这也是我认为它们可能不起作用的原因.

I have looked at these solutions so far, and also here is why I think they may not work.

  1. 复制并粘贴我的虚拟 Env - 不起作用,因为 venv 有自己的结构,并且在其路径中包含我的用户名,它将在其他系统中查找.
  2. 使用 Py2Exe.我有一个 Exe 文件,我现在可以在运行 Windows 10 的其他系统上运行它,而它们没有 python 或我的任何包.但我不确定 VC++ 依赖项是否会出现在 Windows 7 中.它可能还有其他一些我不能冒险的奇怪问题.
  3. 码头工人.我不熟悉 Docker,但如果这是唯一的方法,我可以这样做.

如何在该计算机上运行 python 文件?

How can I run the python file in that computer?

另请注意,我不会有时间在其他系统中乱搞.理想情况下,我必须插入我的 USB 并打开文件才能运行它.如果您认为没有解决方案,请告诉我.

Also note that I will not have the time to mess around in the other system. Ideally I must plug in my USB and Open the file to run it. If you think there isn't a solution to this, please let me know by telling so.

谢谢!

推荐答案

我看到两个选项.

  1. 使用在线 IDE 和 Python 解释器(假设您没有用于下载 Python 的互联网,但通常有互联网).我建议 replit.

使用可移植版本的 Python.这些可以在官方网站中找到,被称为Windows embeddable package"..可以测试下载到usb,在没有Python的电脑上运行;它应该可以工作.

Use a portable version of Python. Those are available in the official website and are called "Windows embeddable package". You can test downloading it to a usb, and running it in some computer without Python; it should work.

这篇关于如何在不安装任何东西的情况下在另一台计算机上运行 Python 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆