Linux on Windows, Python IDE, and VirtualEnv

Linux on Windows

For some tasks, it is still easier to use Windows (Cisco IP Communicator, UCCX Script Editor, CUCM RTMT, etc.), but there is an option to include Linux into the workflow. Recently I discovered the WLS: Windows Subsystem for Linux (WSL), which allows us to install and run sort of Linux on Windows10 side-by-side.

Go to Microsoft Store and search for Linux:

Get, Install and Launch:

Set username and password and you are in Linux:)

Install Python3:

  • sudo apt install python3
  • sudo apt install python
  • sudo apt install python-minimal

I will still be playing and checking this option for Python and scripting. But I see it as a good start and way to run quick files, test things and functions. For bigger projects and scripts I use PyCharm Community (free, open-source) as the Python IDE, but when you need just to make something quick or test something, just a console is the best way.

PyCharm as the Python IDE

From my understanding, PyCharm includes everything you would need into one window: editor, debugger, terminal console, python console, virtual env with different interpreters, git and github integration, etc (I am not there yet:))

Install packages. Once installed, we can import modules into the script:

Pretty easy to use especially with tips from IDE.

Virtualenv

virtualenv is a tool to create isolated Python environments. virtualenv creates a folder that contains all the necessary executables to use the packages that a Python project would need.

sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install virtualenv 

Here some basic usage of the virtual environment.

# create a virtual environment for a project
cd project_folder
virtualenv venv

# activate the virtual environment
. venv/bin/activate

# install packages using the pip command
pip install requests

# once you are done working in the virtual environment you can deactivate 
deactivate

A quick Linux tip: remove not empty folder

rm -rf folder_name

Share

You may also like...

Leave a Reply

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