简体   繁体   English

如何在另一台计算机上打包和运行包含 venvs 的 python 脚本

[英]How to packaging and run python script including venvs on another computer

I'm using python pandas and write a simple script to modify .xlsx files.我正在使用 python pandas 并编写一个简单的脚本来修改 .xlsx 文件。 I want to delivery it as a package that my friends can use by one click ( maybe can add some inputs like file's directory).我想把它作为一个包发送给我的朋友可以一键使用(也许可以添加一些输入,如文件目录)。 I want to know is there any way to do it quickly?我想知道有什么方法可以快速完成吗? Please.请。

You don't want to do it like that.你不想那样做。 Because it is conflicting the main idea of virtual environment.因为它与虚拟环境的主要思想相冲突。 The other computer can have a different operating system, other packages or package versions installed, so copying the files will not work.另一台计算机可以安装不同的操作系统、其他软件包或软件包版本,因此无法复制文件。 The point of a virtual environment is to be able to replicate it everywhere you need it.虚拟环境的重点是能够在您需要的任何地方复制它。

For a solution, you can use pip freeze > requirements.txt to extract your virtual enviroment libraries to txt.对于解决方案,您可以使用pip freeze > requirements.txt将您的虚拟环境库提取到 txt。 Then you can easily type pip install -r requirements.txt然后你可以很容易地输入pip install -r requirements.txt

If you want the exact environment, including system packages, on another computer, use Docker.如果您想要在另一台计算机上的确切环境,包括系统包,请使用 Docker。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 打包可以在未安装Python的计算机上运行的Python脚本? - Packaging a Python script that can be run on a computer that doesn't have Python installed? 如何从另一台计算机运行bash脚本? - How to run a bash script from another computer? 将 python 脚本从另一个存储库打包到烧瓶中 - Packaging a python script from another repository into flask 将Python脚本移动到另一台计算机 - Moving a Python script to another computer 如何在没有 python 的计算机上使用第三方库运行 python 脚本? - How to run python script with third party libraries on computer without python? 如何检查在小型网络中的另一台计算机上是否正在运行相同的python脚本? - How to check if a the same python script is running in another computer in a small network? 如何将带有 mysql 数据库的 python 脚本部署到另一台计算机 - how does one deploy a python script with a mysql database to another computer 如何使用python网络编程在另一台计算机上运行程序? - how to run a program in another computer using python network programming? 如何将默认包添加到所有新的 python 的 venvs - How add default packages to all new python's venvs 相同的 python 脚本在一台计算机上工作,但在另一台计算机上不起作用 - Same python script works in one computer but not in another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM