מה זה תכנות? התקנה וטרמינלWhat is programming? Setup & terminal
איך מחשב מבצע הוראות, התקנת Python ו-VS Code ב-Windows וב-Mac, הטרמינל, והתוכנית הראשונה עם print.
How a computer follows instructions, installing Python and VS Code on Windows and Mac, the terminal, and a first program with print.
התקנה ב-Windows, צעד אחר צעדWindows installation, step by step
- נכנסים ל-python.org/downloads ולוחצים על הכפתור הצהוב Download Python.Go to python.org/downloads and click the yellow Download Python button.
- מריצים את הקובץ. לפני הכול מסמנים למטה Add python.exe to PATH.Run the file. Before anything else tick Add python.exe to PATH at the bottom.
- Install Now. אם מופיע "Disable path length limit", לוחצים עליו (לא מזיק, ועוזר בהמשך).Install Now. If "Disable path length limit" appears, click it (harmless and helps later).
- סוגרים ופותחים מחדש את PowerShell (חלון ישן לא מכיר את ההתקנה החדשה).Close and reopen PowerShell (an old window doesn't know about the new install).
- בודקים:Check:
python --version
py --versionPython 3.13.18 Python 3.13.18
py הוא "משגר" שמגיע עם Python ב-Windows. אם python לא עובד ו-py כן, אפשר להשתמש ב-py בכל מקום שכתוב python.
py is a launcher that ships with Python on Windows. If python fails but py works, use py wherever we write python.
התקנה ב-Mac, צעד אחר צעדMac installation, step by step
- מורידים מ-python.org/downloads את ה-macOS installer.Download the macOS installer from python.org/downloads.
- פותחים את קובץ ה-.pkg ועוברים על המסכים (Continue, Agree, Install).Open the .pkg file and go through the screens (Continue, Agree, Install).
- בתיקייה שנפתחת בסוף, לוחצים פעמיים על Install Certificates.command.In the folder that opens at the end, double-click Install Certificates.command.
- פותחים Terminal ובודקים:Open Terminal and check:
python3 --versionPython 3.13.18
אם מופיעה הודעה שמבקשת להתקין "command line developer tools", זה תקין: מאשרים, מחכים לסיום, ומריצים שוב. ב-Mac לא משתמשים ב-python לבד, רק ב-python3.
If a message asks to install "command line developer tools", that's fine: accept, wait for it to finish, and run again. On a Mac don't use plain python, only python3.
הגדרת VS CodeSetting up VS Code
- מתקינים מ-code.visualstudio.com.Install from code.visualstudio.com.
- Extensions (Ctrl+Shift+X) → מחפשים Python (של Microsoft) → Install.Extensions (Ctrl+Shift+X) → search Python (by Microsoft) → Install.
- File → Open Folder → בוחרים את
python-course.File → Open Folder → choosepython-course. - בוחרים מפרש: Ctrl+Shift+P → Python: Select Interpreter → בוחרים את Python 3.12 ומעלה.Pick an interpreter: Ctrl+Shift+P → Python: Select Interpreter → choose Python 3.12+.
- מפעילים File → Auto Save.Turn on File → Auto Save.
- טרמינל בתוך VS Code: View → Terminal (או Ctrl+`).Terminal inside VS Code: View → Terminal (or Ctrl+`).
ב-Mac מחליפים את Ctrl ב-Cmd בקיצורים.
On a Mac, replace Ctrl with Cmd in shortcuts.
פקודות המפגשCommands for this session
| פעולהAction | Mac (Terminal)Mac (Terminal) | Windows (PowerShell)Windows (PowerShell) |
|---|---|---|
| גרסת PythonPython version | python3 --version | python --version |
| איפה אניWhere am I | pwd | pwd |
| מה יש בתיקייהList the folder | ls | dir |
| כניסה לתיקייהEnter a folder | cd name | cd name |
| תיקייה אחת למעלהUp one folder | cd .. | cd .. |
| יצירת תיקייהMake a folder | mkdir name | mkdir name |
| הרצת קובץRun a file | python3 hello.py | python hello.py |
| מצב אינטראקטיביInteractive mode | python3 | python |
| פתיחת התיקייה ב-VS CodeOpen folder in VS Code | code . | code . |
| ניקוי מסךClear screen | clear | cls |
החץ למעלה ↑ בטרמינל מחזיר את הפקודה הקודמת, ו-Tab משלים שמות של קבצים ותיקיות. חוסך המון הקלדה ושגיאות כתיב.
The up arrow ↑ brings back the previous command, and Tab completes file and folder names. Saves lots of typing and typos.
פתרון בעיות נפוצותTroubleshooting
| בעיהProblem | סיבהCause | פתרוןFix |
|---|---|---|
'python' is not recognized (Windows)'python' is not recognized (Windows) | Python לא ב-PATHPython isn't on PATH | להריץ שוב את ההתקנה → Modify → לסמן PATH. לפתוח PowerShell חדש. בינתיים: pyRerun the installer → Modify → tick PATH. Open a new PowerShell. Meanwhile: py |
python3 פותח את Microsoft Store (Windows)python3 opens the Microsoft Store (Windows) | קיצור דרך של WindowsA Windows shortcut alias | משתמשים ב-python או py. אפשר לכבות ב-Settings → Manage App Execution AliasesUse python or py. You can turn it off in Settings → Manage App Execution Aliases |
command not found: python (Mac)command not found: python (Mac) | ב-Mac הפקודה היא python3On a Mac the command is python3 | מקלידים python3Type python3 |
can't open file ... No such filecan't open file ... No such file | לא בתיקייה הנכונה או שם שגויWrong folder or wrong name | pwd ו-ls, ואז cd לתיקייה הנכונהpwd and ls, then cd into the right folder |
| ▶ ב-VS Code מריץ גרסה ישנה של הקוד▶ in VS Code runs an old version of the code | הקובץ לא נשמרThe file wasn't saved | Ctrl+S או Auto SaveCtrl+S or Auto Save |
| אין כפתור ▶ ב-VS CodeNo ▶ button in VS Code | תוסף Python לא מותקן או הקובץ לא .pyPython extension missing or the file isn't .py | להתקין את התוסף ולוודא שהשם נגמר ב-.pyInstall the extension and make sure the name ends in .py |
| עברית מוצגת הפוך בטרמינלHebrew shows reversed in the terminal | לחלק מהטרמינלים אין תמיכה מלאה בכיוון ימין-לשמאלSome terminals lack full right-to-left support | זה רק בתצוגה. הטקסט עצמו תקין. אפשר להשתמש בטרמינל של VS CodeIt's display only; the text itself is fine. You can use VS Code's terminal |