Hey guys, it's me again easyGoingGuy. Today, you'll learn how to get virtual environment working on your phone. Note: You don't need your phone to be rooted to get start. Requirements:
- Termux ( phone terminal)
- Make sure it's updated and upgraded.
- Get Python working on it
- Make sure python installation package(pip) is available
Okay now that you know the requirements, let's get started. First thing first, let's download the virtual environment tool on the phone by using this command
~ $ pip install virtualenv
now, when it's done downloading, it's time to go back in time. From your current home directory, navigate back and enter the usr directory...
~ $ cd ..
This command will take you back to where you have the home usr directories. So, navigate into the usr directory.
.../file$ cd usr
when you are in, you don't need to bother yourself much about what it contains. Locate bin in this usr directory and then enter it.
.../usr$ cd bin
This directory is where we'll create the virtual environment. To create the virtual environment, use the command
.../usr/bin$ virtualenv my_virtual_state
Where my_virtual_state is just a regular name, you can use any name you prefer. To know if this was successful, use the command
.../usr/bin$ ls
this will list all the files and directories you have in that current directory where you created your virtual environment. since my virtual environment starts with my headword, so I'll go directly to where m is and start checking for my . So this will just make you find it faster. When you've found it, it means it has been created successfully. The next step will be to activate your virtual environment but before that let's see what it contains. Navigate into the virtual environment directory you just created. For me I'll be using the command
.../usr/bin$ cd my_virtual_state
You will see different directories there such as bin lib pyvenv.cfg. Now, navigate into the bin directory. When you list it, you'll see different files inside it. Take note of the activate there, it will be the script that will be used to activate our virtual environment. Now, navigate back to the directory where you created your virtual environment directory. You can use this short cut command
.../my_virtual_state/bin$ cd ../..
Now, let's activate our virtual environment. Use the command
.../usr/bin$ source my_virtual_state/bin/activate
When you see something like this,
(my_virtual_state) .../usr/bin$
it means you are now in the virtual environment, so whualla!!! Enjoy using your virtual environment on phone. There are numerous advantage of using virtual environment but I won't put that in this article. Stay updated with me to get more useful tips. Remember, I remain easyGoingGuy. Enjoy!!! 🥳