Joke Collection Website - Public benefit messages - How to run Python on a mobile phone, but the code running on a computer can't run on a mobile phone?
How to run Python on a mobile phone, but the code running on a computer can't run on a mobile phone?
You can install a Python simulator, such as QPython.
After installing this apk, you can run Python scripts on Android.
About QPython3L, online search instructions:
QPython- instructions for use
A. Panel
Figure-Startup Panel
QPython is a Python engine on Android system. With QPython, you can use Python well on the Android system.
QPython needs you to give system permissions such as network, Bluetooth and geographical location, so that you can use these features to program. Of course, QPython doesn't need you to give permission to read mobile phone information, read short messages, access mobile phone accounts, etc., so you can't use this related interface of SL4A. If you need more open permissions to program, please use more open QPython3.
Of course, neither QPython nor QPython3 will use these permissions to collect your personal information, they are only used when you are programming. (Note: We will use network permissions to check whether it is the latest version)
This wizard is based on the latest version of QPython 1.0.4. If you are not using the latest QPython, please update it as soon as possible.
After installing QPython, run it, and then you will see the startup interface as shown in the figure.
Start button
After clicking the button with Python logo in the middle of the screen, the startup menu will be displayed. Yes: QR code picture reading code? An interesting way to share and publish code can be achieved through? QPython's QR code generator creates a QR code picture)? Run the script in the device? *? Run the project in the device.
Figure-Start button
If you are using version >; =0.9.8, you can run php_console.py in the script directory to install many third-party libraries.
If you want to run a specific script or project after clicking the Start button instead of displaying the selection menu by default, you can do so by "Set Default Program" in the settings page.
Developer tool panel
If you slide the start button panel to the left, you will see another main panel. For developers, it will be more practical and convenient.
Figure-Developer Panel
There are many useful functions here:
Console? Yes, it is a common Python console, and you can directly interact with the Python parser.
Editor? -QPython's built-in code editor allows you to edit and run code directly in QPython applications.
Program? -You can find your QPython scripts and projects here. After the default installation, there will be some sample scripts and projects.
Library? You can install many Python libraries here.
Community? Through the community, you can learn and use QPython better and more deeply here and participate in the construction of QPython.
Next, let's look at the console and editor:
B. console and editor
Figure-Console
If you press and hold the console or editor icon on the developer panel, you can also create a shortcut on the desktop. Click it to go directly to the console or editor.
comfort
Figure-Entering the console from the notification bar
As I said before, QPython has the same Python console as PC, and many users are used to using it to explore the properties of programming objects, experiment with syntax or test their existing ideas. You can type commands directly into the terminal and let the Python parser execute them. Click the "+"icon in the upper right corner of the console to create a new terminal window. Click the arrow in the upper left corner to display the list of currently opened console windows, and you can switch to a different console. To close the console, just click the close button "X".
Please note that after opening the console, a small terminal icon will appear in the message prompt bar, unless you close the terminal. If you open the prompt window and click the terminal icon, you can return to the terminal again.
edit
Graphic editor
QPython's embedded editor allows you to develop Python conveniently in your palm. It has the following functions:
opening file
Create a new file or project
Left indent 4 spaces.
Tighten 4 spaces to the right.
Jump to the specified line
Save the current file.
Run the current Python file.
Undo the previous operation.
Search by keyword
Displays a list of recently edited files.
Insert code fragment
Set editor default behavior
The editor allows you to enter and edit text. You can develop your scripts, save them and run them. The editor supports Python syntax to highlight the number of rows.
As you type, you can use the first two icons ""to easily control the shrinkage level (which is very important for Python). Next is "jump to? Line ",click the icon, enter the number of lines and quickly jump to the number of lines you want to jump, and then save? And then what? Save as, and then? Run, undo,? Search,? Recently opened? Code snippet? And then what? Editor settings? Button. Don't forget what else is on the right side of the top navigation? Open it? And then what? New button.
When saving, don't forget to add a suffix. " Py "as a suffix, because the editor will not complete it automatically.
C. procedure
In the program, you can manage your scripts and projects, which are located at/sdcard/com.hipppal.qpyplus/scripts and/sdcard/com.hipppal.qpyplus/projects respectively.
After entering the program, when you hold down a script or project, you can create a shortcut corresponding to the script or project on the desktop. After creating shortcuts, you can launch them directly from the desktop.
script
Figure-Scripts and Click Options
A script is a simple file. The script is located in the directory/sdcard/com.hipppal.qpyplus/scripts. If you want your own scripts to appear here, please put them in this directory.
After clicking the script, you can do the following:
Run: Run the script.
Open: Use the embedded editor to edit the script.
Rename: Rename the script.
Delete: Delete the script.
project
Figure-Project and Long Press to Create Shortcuts
The project contains main.py as the directory of the default startup script, where you can put libraries or resources that third parties depend on. If you want your project to be discovered automatically by QPython, please put it in the directory of/sdcard/com.hipppal.qpyplus/projects.
When you click an item, you can:
Run the project
Open the project with the Resource Browser to view its resources.
Rename project
Delete the item.
D. library
Library is an important part of QPython. Through the library, you can install Python libraries. Here, you can install many libraries written in pure Python from the official Pypi source code (if there is a c/++ file to compile, it will fail because you can't find the compilation chain tool).
Graphic library
Manual installation library
Usually, you can also install the library manually by putting it in the directory/sdcard/com.hipppal.qpyplus/lib/python2.7/site-packages.
However, if you have. So the files in your library, and you have tried to put them in the directory of sdcard and failed to load them successfully, you need to try this step: install them in the directory of/data/com.hipppal.qpyplus/files/lib/python2.7/site-packages/
Install from QPypi
Figure-Installing from QPypi
We provided a QPypi web service and published several libraries. After clicking the details, you can install the library by clicking "Install" (it actually calls the pypi tool to do this).
About the QYPPI service, we are currently maintaining the QYPPI service. Developers of third-party libraries are welcome to contact us. We can create a QYPPI account for you, and then you can use QYPPI system to maintain your Python library in QYPPI.
Install from official Pypi
Figure-Installing from Pypi
Click and enter the pypi command interface, and call the pypi tool to let you install it yourself. You only need to enter a pip command, such as pip install [HTML_REMOVED]], to install this library. However, it should be noted that libraries with files to be edited such as c/c++ cannot be installed at present, because Android has no tool chain to compile by default.
Generally, packages installed through QYPI or Pypi will be installed in the/data/com.hipppal.QYPPlus/files/lib/Python2.7/site-packages/directory.
E. community
Figure -QPython community
You can meet other QPython users in the community. You can ask questions, participate in topic discussions, submit BUG//suggestions to developers, etc.
In addition, we will actively promote QPython to be completely open source, so we also welcome enthusiastic users to join us. We urgently need your help in the following aspects:
Internationalization of language
Help us test and submit test feedback.
Feedback questions and submit good suggestions.
Establish local communities, hold local technical lectures and learn from each other.
other
- Related articles
- I have configured many computers with LAN IP. Please tell me how to write a program that can send information to an IP in easy language. thank you
- Is it reliable for mobile to call and say that sending traffic requires verification code?
- Received a text message saying that he was going to evacuate from the warehouse.
- Short stroke order pinyin
- Shenzhen traffic violation inquiry
- How to set the invisible number of votes in the test paper star voting?
- Can a wife divorce by sending an ambiguous message to others?
- Seizure execution notification SMS
- The sweaty summer of 2022_warm reminder of the hot summer blessings
- How to open the personal SMS notification function through China Bank Mobile Banking?