Skip to content
GitHub

Setup & Installation

မစတင်ခင် Python ကို ဘာကြောင့် လေ့လာသင့်သလဲ ဆိုတာ တစ်ခွန်းနဲ့ ရှင်းပါတယ် — Python ဟာ လက်ရှိ ကမ္ဘာမှာ အသုံးအများဆုံး Programming Language တစ်ခုဖြစ်ပြီး Web, AI, Data Science, Automation တွေမှာ ရေသောက်မြစ်လို သုံးနေကြပါတယ်။


အဆင့် ၁ — Python တပ်ဆင်ခြင်း

Section titled “အဆင့် ၁ — Python တပ်ဆင်ခြင်း”

python.org ဝဘ်ဆိုဒ်ကနေ Python ကို အခမဲ့ Download ပြုလုပ်နိုင်ပါတယ်။

https://python.org/downloads

“Download Python 3.x.x” ဆိုတဲ့ ခလုတ်ကြီးကို နှိပ်ပြီး Installer ကို Download ပြုလုပ်ပါ။

Python မှန်မှန်ကန်ကန် တပ်ဆင်ပြီးလားဆိုတာ စစ်ဆေးနည်း:

Terminal (Windows မှာ Command Prompt သို့မဟုတ် PowerShell) ကို ဖွင့်ပြီး အောက်ပါ Command ကို ရိုက်ထည့်ပါ:

Terminal window
python --version
Python 3.12.0

ဒီလို Python version number ပြပေးရင် မှန်ကန်စွာ တပ်ဆင်ပြီးပါပြီ။


အဆင့် ၂ — VS Code တပ်ဆင်ခြင်း

Section titled “အဆင့် ၂ — VS Code တပ်ဆင်ခြင်း”

VS Code (Visual Studio Code) ဆိုတာ Microsoft ဖန်တီးထားတဲ့ Code Editor တစ်ခုဖြစ်ပြီး Python ရေးဖို့ အသင့်တော်ဆုံး Editor ပါ။ Code တွေ Highlight ပြပေးတာ၊ Error တွေ ချက်ချင်းညွှန်ပြတာ၊ Terminal ပါ built-in ထည့်ပေးထားတာ တွေ ကြောင့် Beginner တွေ အတွက် အလွန် ကောင်းမွန်ပါတယ်။

https://code.visualstudio.com
  1. VS Code ကို Download ပြုလုပ်ပြီး Install လုပ်ပါ
  2. VS Code ကို ဖွင့်ပါ
  3. ဘယ်ဘက် Sidebar မှာ Extensions Icon (⊞) ကို နှိပ်ပါ
  4. Search Box မှာ Python လို့ ရိုက်ပါ
  5. Microsoft ရဲ့ Python Extension ကို Install နှိပ်ပါ

အဆင့် ၃ — ပထမဆုံး Python Program ရေးခြင်း

Section titled “အဆင့် ၃ — ပထမဆုံး Python Program ရေးခြင်း”

VS Code မှာ File → Open Folder ကနေ ကိုယ်ရဲ့ Projects Folder ကို ဖွင့်ပါ (ဥပမာ Desktop/my-python-projects)။

File အသစ် ဖန်တီးခြင်း

Section titled “File အသစ် ဖန်တီးခြင်း”

Folder မှာ File အသစ် ဖန်တီးပြီး hello.py လို့ အမည်ပေးပါ (.py Extension ကို မမေ့ပါနဲ့ — Python ဖိုင် ဆိုတာ ဒါနဲ့ သိတာပါ)။

print("မင်္ဂလာပါ, Python!")
print("ကျွန်တော်/မ ပထမဆုံး Program ကို ရေးနိုင်ခဲ့ပါပြီ!")

VS Code Terminal ကိုဖွင့်ပါ (View → Terminal) ပြီး:

Terminal window
python hello.py

ဒီလို ပြပေးရမည်:

မင်္ဂလာပါ, Python!
ကျွန်တော်/မ ပထမဆုံး Program ကို ရေးနိုင်ခဲ့ပါပြီ!

ဒါဆိုရင် Python လေ့လာဖို့ ပြင်ဆင်မှု ပြည့်စုံသွားပါပြီ!


Python REPL — ချက်ချင်း စမ်းသပ်နိုင်သော Scratchpad

Section titled “Python REPL — ချက်ချင်း စမ်းသပ်နိုင်သော Scratchpad”

Terminal မှာ python လို့ ရိုက်ပြီး Enter နှိပ်လိုက်ရင် Python REPL (Read-Eval-Print Loop) ထဲ ရောက်သွားပါမယ်။ REPL ဆိုတာ Code တစ်ကြောင်းကို ချက်ချင်း Run ကြည့်လို့ ရတဲ့ ပုံစံပါ — Calculator တစ်ခုနဲ့ တူပါတယ်။

>>> 2 + 2
4
>>> print("မင်္ဂလာပါ")
မင်္ဂလာပါ
>>> "python".upper()
'PYTHON'
>>> exit()

>>> ကို မြင်ရရင် REPL ထဲ ရောက်နေတာပါ။ ထွက်ဖို့ exit() လို့ ရိုက်ပါ။


Setup လုပ်တာနဲ့ပတ်သက်ပြီး အဖြစ်များတဲ့ Error တွေ:

Errorအဓိပ္ပာယ်ဖြေရှင်းနည်း
python is not recognizedPATH မထည့်ဘဲ Install လုပ်ထားPython ကို Uninstall ပြီး “Add to PATH” check ထားပြီး ပြန် Install
SyntaxErrorCode ရေးပုံ မှားနေError message ရဲ့ line number ကြည့်ပြီး စစ်ဆေးပါ
File မတွေ့Terminal folder မှားနေhello.py ရှိတဲ့ Folder ထဲ Terminal ရောက်နေရမည်