Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Test Analysis of Python Transplant run

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "Python transplant run test analysis". In the daily operation, I believe many people have doubts about Python transplant run test analysis. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "Python transplant run test analysis". Next, please follow the editor to study!

Go to the _ install/bin directory and use the command. / python, and then use import to load the modules as shown in figure 92.3.1.1, and the python migration is successful. Press ctrl+D to exit.

92.3.2 Database testing

The routine sqlite3test.txt of the sqlite3 database is provided in the provided package, which is explained below.

Import sqlite3 # Import SQLite driver

Conn = sqlite3.connect ('test.db') # connects to the SQLite database. The database file is test.db. If the file does not exist, it will be automatically created in the current directory.

Print "Opened database successfully"

Cursor = conn.cursor () # create a Cursor

Cursor.execute ('create table user (id varchar (20) primary key, name varchar (20))')

# execute a SQL statement to create the user table

Cursor.execute ('insert into user (id, name) values (\' 1\',\ 'Michael\'))

# execute a SQL statement and insert a record

Cursor.execute ('insert into user (id, name) values (\' 2\',\ 'jack\'))

Print "Records created successfully"

Cursor.rowcount # gets the number of rows inserted through rowcount

Cursor.close () # close Currsor

Conn.commit () # commit transaction

Conn.close () # close Connection

Execute the command ". / python sqlite3test.txt" to see that the database file test.db file is generated.

92.3.3 time and datetime tests

We can adjust the time first: "date-s" 2020-07-21 16:02:00 "& & hwclock-- systohc"

The time test routine timetest.txt provided in the compressed package of the request, copy the test routine to the / data/_install/bin of the open board, and execute the command ". / python timetest.txt" to complete the conversion of time format and the calculation of microsecond time difference.

After the above steps are correct, add the environment variables to the / etc/profile file:

Export LD_LIBRARY_PATH=/data/_install/libLD_LIBRARY_PATH

92.3.4 Migration of sqlite3 Library

This chapter will produce the install_python files used in chapter 2. 4. You can also download the latest database from the sqlite official website, copy it to the / home/ubuntu/python/ directory through ssh, decompress it with the command "tar-vxfsqlite-autoconf-3240000.tar.gz", and generate a folder "sqlite-autoconf-3240000" as shown in figure 92.3.4.1:

Enter the folder "sqlite-autoconf-3240000" generated after decompression, execute the command ". / configure-- host=arm-none-linux-gnueabi-- prefix=/home/ubuntu/python/sqlite-autoconf-3240000/install_python--enable-shared", and generate files such as Makefile after success, as shown in figure 92.3.4.2.

Perform make compilation, as shown in figure 92.3.4.3:

Execute the command "make install" and you will see that the folder install_python is generated in the sqlite-autoconf-3240000 directory. By executing the command "ls install_python", you can see that there are three folders under the directory: bin include lib.

At this point, the sqlite3 library has been compiled, users need other library files can also be compiled.

At this point, the study on "Python Migration running Test Analysis" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report