[英]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.