Using Pyinstaller to make executable programs that contain Oracle databases

Source: Internet
Author: User

Using Pyinstaller to make executable program preparation with Oracle database

First refer to [Linux on PIP installation cx_oracle] To install cx_oracle Library and Oracle driver instantclient_11_2.
This assumes that the Oracle driver or extract to the/opt/instantclient_11_2 directory, the content is as follows:

/opt/instantclient_11_2├── adrci├── BASIC_LITE_README├── genezi├── libclntsh.so.11.1├── libnnz11.so├── libocci.so.11.1├── libociicus.so├── libocijdbc11.so├── ojdbc5.jar├── ojdbc6.jar├── sdk├── uidrvci└── xstreams.jar
Test program

Create a directory MyApp, under which a new test.py file is created with the following contents:

import cx_Oracleconn = cx_Oracle.connect(‘jhinno/[email protected]/jhinno‘)  cursor = conn.cursor ()cursor.execute ("select sysdate from dual")row = cursor.fetchone ()print rowcursor.close ()conn.close ()
Packaging spec Files

In the MyApp directory, create the Test.spec file with the following content:

#-*-Mode:python-*-A = Analysis ([' test.py '], pathex=[' MyApp '], hiddenimports=[], hookspath=None, runtime_hooks=None) a.binaries = A.binaries + [(' libclntsh.so ','/opt/instantclient_11_2/libclntsh.so.11.1 ',' BINARY ')]a.binaries = A.binaries + [(' libnnz11.so ','/opt/instantclient_11_2/libnnz11.so ',' BINARY ')]a.binaries = A.binaries + [(' libocci.so ','/opt/instantclient_11_2/libocci.so.11.1 ',' BINARY ')]a.binaries = A.binaries + [(' libociicus.so ','/opt/instantclient_11_2/libociicus.so ',' BINARY ')]pyz = Pyz (a.pure) exe = EXE (PYZ, a.scripts, A.binaries, A.zipfiles, A.datas, Name=' Test ', debug=False, strip=None, upx=True, console=True)

Note the configuration of a.binaries, which adds the libraries that Oracle needs to use.

Packaged

Run the Pyinstaller command as follows:

pyinstaller test.spec

The executable file that generates test in the Myapp/dist directory after packaging can be run directly to test.

Please indicate this address in the form of a link.
This address: http://blog.csdn.net/kongxx/article/details/50637058

Using Pyinstaller to make executable programs that contain Oracle databases

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.