Python program packaging and python Packaging
Environment: CentOS6.5 _ x64
Python: 2.6
Use pyinstaller to package
Pyinstaller can package a python program into a binary file. The packaged file can also be executed in an environment without python (however, the underlying libc-related so file must exist ). Pyinstaller supports packaging a python program into a single file. All it does is convert the text into binary, which does not speed up python. On the contrary, it also affects the running speed of the packaged program.
Install pyinstaller
Official Website: http://www.pyinstaller.org/
Install using pip:
pip install pyinstaller
Install using source code:
python setup.py install
Package
With the-F parameter, You can package the program into a separate file:
pyinstaller -F test1.py
Use virtualenv to package
Virtualenv is used to create an "isolated" Python runtime environment for an application. Using virtualenv to manage python applications can avoid problems caused by library conflicts. Similarly, virtualenv cannot speed up python. It only isolates the environment and facilitates deployment.
Example:
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 necessary python libraries
pip install …
5. After writing the code, start the program normally.
Okay, that's all. I hope it will help you.
Github address:
Bytes
Please add