Home >Backend Development >Python Tutorial >Detailed explanation of python program packaging
Environment: CentOS6.5_x64
Python version: 2.6
pyinstaller can package python programs into binary files. The packaged files are in an environment without python It can also be executed (but there must be relevant underlying libc related so files). pyinstaller supports packaging python programs into a single file. All it does is convert text into binary, which does not speed up python. On the contrary, it will affect the running speed of the packaged program.
Install through pip:
pip install pyinstaller
Install through source code:
python setup.py install
Add the -F parameter. Package the program into a separate file:
pyinstaller -F test1.py
virtualenv is used to create an "isolated" Python running environment for an application. Using virtualenv to manage python applications can avoid problems caused by library conflicts. Similarly, virtualenv cannot speed up Python. All it does is isolate the environment and make deployment more convenient.
Examples are as follows:
1. Install virtualenv
pip install virtualenv
2. Create a virtual environment
virtualenv -p /usr/bin/python2.6 py26env --no-site-packages
3. Start the virtual environment
source py26env/bin/activate
4. Install the necessary python libraries
pip install …
5. After writing the code, start the program normally.
The above is the detailed content of Detailed explanation of python program packaging. For more information, please follow other related articles on the PHP Chinese website!