Android

How to install and code Python on Android with Pydroid 3

Programming on the go in Python is possible, thanks to the Pydroid 3 Integrated Development Environment (IDE). Pydroid is a simple Python 3 compiler that lets you do small projects and do minimal coding on your Android device.

If you also want to learn Python programming anywhere without a computer, while copying the Python computer platform on Android, then Pydroid 3 is the right app to try.

Whether you’re new to Python programming or you’re an expert, let’s see some of the ways you can use Pydroid 3 to take advantage of its full potential on your Android device.

How to install and code Python on Android with Pydroid 3 - Android

Get Pydroid 3 and set up its add-ons

Pydroid 3 IDE is available on the Play Store. However, to make the app more useful and easy to handle, you need to download the repository extension for Pydroid from Play Store as well. While installing this add-on may not be mandatory, it makes automatic package installation much easier with Pip.

By default, Pydroid 3 does not have permission to access your device’s storage. This makes creating project folders difficult or impossible without some technical manipulation. To solve this problem, download the permission extension for Pydroid from the Play Store, which allows Pydroid to create folders and files on your device.

Download: Pydroid 3 — IDE for Python 3 (Free, in-app purchases available)

Download: Pydroid repository plugin (Free)

Download: Pydroid permissions plugin (Free)

install packages

Once you have everything set up, you can start using Pip To install packages for your projects, just like on PC. Pydroid 3 comes with an interface that allows you to install packages without typing your commands in Terminal.

There are several ways to install Pip packages on Pydroid 3. To access this feature, tap on the menu icon (which looks like three lines) in the top left corner of the app. Next, go to Pip. At the top of the Pip menu, select SEARCH LIBRARIES To get more options about the unit you want to install. Or you can click an option Quick Installation To install the packages listed by default.

How to install and code Python on Android with Pydroid 3 - Android

However, the best and free option is to click on Installations and select square Use the repository of pre-created libraries. Next, type your preferred package name in the search bar and hit the install button to get the named package.

To check if the package was installed successfully, click Option LIBRARIES. This menu allows you to access a list of all the libraries that are currently installed.

How to install and code Python on Android with Pydroid 3 - Android

Use the built-in Pydroid 3 command line interface

Pydroid 3 provides a minimal Linux command line interface (CLI) as well. To access it, tap the menu icon in the top left corner of the app, and select Terminal.

How to install and code Python on Android with Pydroid 3 - Android

Although running an order pip install packages Via the Terminal interface it takes a while to load, but it still lets you easily move between folders and create new ones wherever write permission is allowed on your device. However, while the slow loading of installation packages via Terminal is a minor problem with the Pydroid IDE, its Pip menu solves it.

If you want to use the provided command line for any other purpose, the Android operating system is based on Linux, so you must have a basic understanding of how to use the Linux command line.

Use Python Shell

The blank page that appears when you open Pydroid 3 is the built-in Python Shell. Just like the Python shell on your computer, it sees any command written to it as a Python icon by default.

To use the shell, type any Python command and click the big run button in the editor’s bottom left corner. This opens the Python interpreter which displays the output of your code.

However, you can also access the Python shell from the command line. To do this, go to Terminal by clicking on the menu icon in the upper left corner of the application. Next, type python and click input arrow on the soft keyboard to open the Python interpreter command line. write exit() To leave the Python shell command line.

How to install and code Python on Android with Pydroid 3 - Android

Save folders and files on your device

Just like any other code editor, Pydroid 3 has an interface that allows you to save your file in any folder on your device. If you want to create a project folder, you can also create new folders with file saving options.

To use the folder option, click the folder mark in the upper-right corner of the edit cover. Click Save and select Internal Storage. Next, click on the preferred destination folder and press SELECT FOLDER at the top of the screen. In the following list, enter your preferred file name and click save.

How to install and code Python on Android with Pydroid 3 - Android

However, if you want to create a new project folder, repeat the above process, but click Option NEW FOLDER instead of SELECT FOLDER. Give your new folder a preferred name and tap construction to save the folder. Next, click on the Select folder option. Name your new file and click save To save your new file in the folder you just created.

Note that the newly created file does not need a file extension if it is a Python file. But in case you need to use another language file to service your project, be sure to include the file extension that applies to that language while saving that file. For example, your CSS file should be saved as Name.css , replacing Name with your preferred file name.

How to install and code Python on Android with Pydroid 3 - Android

To update changes you’ve made to an existing file, click the folder tab in the top-right corner of the editor, and select save.

To create a completely new file, click on the folder label. Locate new And follow the previously described steps to save your file to any folder. If you want the new file to be in the same directory as the current folder, be sure to select the same folder that contains the current file.

Post your source code on Pastebin

You can share your knowledge and progress with others on the Pastebin platform if you like. To do this, click on the menu icon in the upper left corner of the application. Next, select Pastebin and click Yes. In the next menu that pops up, tap COPY URL To copy the link to the source code.

How to install and code Python on Android with Pydroid 3 - Android

Open any browser on your Android device and paste the copied link on the search bar to see your source code on Pastebin. You can also share this link with the people you want to give access to your code.

IDE customization

You can also customize the development environment if you like. To change the appearance of your editor, tap the menu icon in the upper left corner of the screen and go to الإعدادات -> المظهر To switch to your preferred theme, or select other available theme options.

How to install and code Python on Android with Pydroid 3 - Android

To get more customization features, click on the editor option and select your preference. You can also click Other options under the Settings menu to see the options available to you.

However, when you click on the menu icon, the Terminal settings option offers some configurations that are specific to the Terminal interface as well.

Pydroid 3 is a Python virtual environment on Android

Installing Pydroid 3 IDLE on your Android device automatically downloads and installs Python 3 on it as well. However, Pydroid 3 IDLE installed for Python runs as the default environment on Android.

That’s because trying to run the Python shell outside of the Pydroid IDLE command line causes an error.

If you are interested in learning and giving it a try, you need to install a dedicated third-party Android CMD app, preferably Termux from Play Store.

Once you have Termux installed, open it up, and make sure you have Pydroid 3 installed as well. then type python on Termux CMD. It throws an error in the file directory, indicating that Python does not exist in the Android global space until it is installed with the command pkg install python via Termux.

However, running Python on the included Pydroid 3 enables you to successfully access the Python shell.

Download: Termux (Free)

Can you use Pydroid for any project?

Although programming on Android can be interesting, using Pydroid to manage a large project is not recommended. However, it is another way to embark on small projects, especially when it is not for real-life, long-term purposes.

In addition to managing small projects, Pydroid 3 is also a great tool to play around with to improve your Python coding skills, especially if you don’t have a computer to run your Python applications. Learn about the 5 best sites to learn Python online for free.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker