Can python run on Android? Can python run on Android?

Hello everyone, the editor is here to answer the following questions for you. Can python be programmed to run on Android systems? Can python programs be run on Android phones? Now let’s take a look!

1. The words written in front

  I run Python code on the PC every day. Today, I suddenly had an idea and wondered if I could run Python code on the mobile terminal. If this can be achieved, the used mobile phones at home will be put to use.

2. Installation environment

2.1 Install APK

  According to search and research, the following three APKs need to be installed, namely QPython3, QPython, and QPy3.6 python language main word annotations . The package download link is https://download.csdn.net/download/herosunly/16683910 . In order to help everyone improve their Python programming skills, if you purchase
the Quick Start Column for Python Beginners , you will receive a free download file of this article. After purchasing, just leave your email address in the comment area of ​​this post.

  After installation, there are the following three APPs (QPython 3S, QPython OS, QPy3.6):
Insert image description here

2.2 Install Python library

  Open QPython 3S and click QPYPI, as shown below:

  There are two ways to install Python libraries, as shown in the figure below:

  1. QPYPI installation method, but only includes some libraries, such as keras, matplotlib, numpy, pandas, etc. The specific list is shown in the figure below:
  1. Install via official pypi.

  The QPYPI method is relatively simple. Here I will demonstrate the following official pypi method. Taking the installation of requests as an example, the installation command is pip3 install requests==2.25.1 ( note that adding the version number when typing ):

  When you see Successfully installed requests When you wait for the library, the installation is successful, as shown in the figure below:

3. Run the code

  To keep it simple, use the terminal to run a small piece of code.
Insert image description here

3.1 Small bugs appear

  In order to inspire others, here is a simple crawler code:

import requests
res = requests.get("https://blog.csdn.net/herosunly/article/details/115728528")
print(res.status_code)

  Unfortunately, an error was reported: SSL: NO_CIPHERS_AVAILABLE ERROR, as shown below:

3.2 Correct code

import requests
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = "TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:ECDHE:!COMPLEMENTOFDEFAULT"

res = requests.get("https://blog.csdn.net/herosunly/article/details/115728528")

print(res.status_code)

  The screenshot after successful operation is as follows:

Guess you like

Origin blog.csdn.net/chatgpt002/article/details/132866710