Skip to main content
SNP-2025-0025
Home / Code Snippets / SNP-2025-0025
SNP-2025-0025  ยท  CODE SNIPPET

๐Ÿ“Œ Fix: “Python was not found” Error on Windows

Python ยท Published: 2025-02-05 ยท debmedia
01
Problem Statement & Scenario
The Problem

โœ… Step 1: Check if Python is Installed Correctly

1๏ธโƒฃ Open Command Prompt (CMD)

  • Press Win + R, type cmd, and press Enter.
    2๏ธโƒฃ Type the following command and press Enter:
python --version

OR

py --version

๐Ÿ”น If you see a Python version (e.g., Python 3.x.x), Python is installed correctly.

3๏ธโƒฃ If CMD still shows "Python was not found", continue to Step 2.


โœ… Step 2: Add Python to System PATH (Manual Method)

If Python is installed but not recognized in CMD, you need to add it to the system PATH manually.

1๏ธโƒฃ Find Python Installation Path:

  • Open File Explorer (Win + E).
  • Go to C:UsersYourUsernameAppDataLocalProgramsPythonPython3X (or wherever Python was installed).
  • Copy the full path (Example: C:Python310 or C:UsersYourNameAppDataLocalProgramsPythonPython310).

2๏ธโƒฃ Add Python to System Environment Variables:

  • Press Win + R, type sysdm.cpl, and press Enter.
  • Go to the Advanced tab โ†’ Click Environment Variables.
  • Under System Variables, find Path, then click Edit.
  • Click New, then paste your Python path (e.g., C:Python310).
  • Click OK โ†’ OK โ†’ Restart your computer.

3๏ธโƒฃ Test Again in CMD:

  • Open Command Prompt and type:shCopyEditpython --version
  • If Python is recognized, you're good to go! ๐ŸŽ‰

โœ… Step 3: Install Required Python Packages

Once Python is working, install dependencies needed for the script:

1๏ธโƒฃ Open Command Prompt
2๏ธโƒฃ Run the following command to install required Python libraries:

pip install openai pandas requests

โœ” This will install OpenAI API, Pandas (for CSV handling), and Requests (for HTTP requests).


โœ… Step 4: Run the Python Script

Now that Python is installed, you can run the malware blog post generator script.

1๏ธโƒฃ Move your Python script (malware_post_generator.py) to a folder (e.g., C:MalwareScripts).
2๏ธโƒฃ Open Command Prompt and navigate to the script's folder:

cd C:MalwareScripts

3๏ธโƒฃ Run the script:

python malware_post_generator.py

1-on-1 Technical Mentorship

Want to master snippets like this?

Debasis Bhattacharjee offers direct mentorship sessions for developers looking to level up their code quality, architecture decisions, and production engineering skills. Two decades of real-world experience โ€” no theory, just craft.