简体   繁体   English

在Linux上打包(归档)Python项目

[英]Packaging (archiving) Python project on Linux

I have a Python project with various Python modules. 我有一个带有各种Python模块的Python项目。 Now, when I need to set the project to another server (Linux OS), I have also set up each module, which are important to the project. 现在,当我需要将项目设置到另一台服务器(Linux OS)时,我还设置了每个模块,这对项目很重要。

My question is: how can I package (or archivate) module dependencies and projects set to another server with just unpackage (or unzip) and etc.? 我的问题是:如何仅通过解包(或解压缩)等方式将模块依赖项和项目打包(或归档)到另一台服务器?

UPDATE: Finally I use cx_Freeze, which work fine for my project. 更新:最后,我使用cx_Freeze,它对我的​​项目工作正常。 But guys gave really useful advice. 但是伙计们给出了非常有用的建议。

Python has a nice way to deal with projects and dependencies: Virtual Environments . Python有一个很好的方式来处理项目和依赖项: Virtual Environments

An interesting article: 有趣的文章:

You can use a combination of virtual environments (not necessary if you do not want it) and pip. 您可以组合使用虚拟环境(如果不需要,则不需要)和pip。 You can give pip a file with all your dependencies like so: 您可以给pip一个具有所有依赖性的文件,如下所示:

pip install -r requirements.txt

For more information on how to create this requirements.txt please see http://www.pip-installer.org/en/latest/requirements.html More information on the virtualenv is here http://www.virtualenv.org/en/latest/ 有关如何创建此requirements.txt的更多信息,请参见http://www.pip-installer.org/en/latest/requirements.html有关virtualenv的更多信息,请参见http://www.virtualenv.org/en /最新/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM