Setting up python workspace on windows

Setting up python workspace on windows

Steps:

  • Install Python.

  • Install and IDE (Microsoft VSCode or PyCharm).

  • Creating a virtual Environment.

In an enterprise environment, follow your IT administration teams instructions for installations. Like raising a ticket or incident.

Installing Python

  • Once downloaded, double click on the downloaded file and follow onscreen suggestions, choosing yes or ok.

  • To verify if python got installed run the following command in a terminal python --version, it should return version details.

Installing an IDE

Creating a Virtual-Environment

Virtual environment's help in isolating python packages to be installed and restricted for a specific project. A virtual environment can be created and activated with couple of commands.

  • Navigate to a desired folder where you want to place your project files.

  • Open terminal at same location and run python -m venv .venv

  • It will create a new folder named .venv

  • To activate the virtual environment use .venv\Scripts\activate.bat

  • The command prompt will change as shown below.

You can now open the projects in your favorite IDE and open terminal in IDE to work with a virtual environment.

Best Practice:

  • Place all your project requirements in a requirements.txt file at root folder so it can be installed easily.

  • To install packages from requirements.txt use pip install -r requirements.txt