Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows

วิธีติดตั้ง Python บน Windows 10

วิธีติดตั้ง Python บน Windows 10

Python เป็นภาษา General-purpose ใช้สร้างได้ทุกอย่าง ถ้ามีเครื่องมือและ Library ที่เหมาะสม เหมาะสำหรับ Backend web development, Data analysis, Scientific computing, AI, Game development, Mobile/Desktop apps และ Productivity tools เรียนรู้ง่าย ไม่ได้อยู่ในกลุ่ม "ยากและซับซ้อน"

ดาวน์โหลด Python

ไปที่หน้าดาวน์โหลดทางการของ Python ดาวน์โหลดเวอร์ชันล่าสุด ค่าเริ่มต้นคือ 32-bit installer แนะนำให้ใช้ 32-bit เพื่อความเข้ากันได้ (มี 64-bit ให้เลือกได้)

วิธีติดตั้ง Python บน Windows 10

หมายเหตุ: มี Python 2 และ 3 - Python 2 เป็นเวอร์ชันเก่า แต่ยังนิยมใช้ Python 3 เป็นเวอร์ชันปัจจุบันและอนาคต Python 2 จบชีวิต (EOL) ปี 2020 รับเฉพาะ Bug fixes บทความนี้เน้น Python 3

ติดตั้ง Python จาก Installer

  1. คลิกขวาไฟล์ที่โหลดมา → Run as Administrator → เลือก Customize Installation
  2. หน้าต่าง Optional features → ติ๊กทุกช่อง → Next
  3. หน้า Advanced Options ตั้งตำแหน่งติดตั้ง (แนะนำ C:\Python36-32) → Install
  4. ติดตั้งเสร็จ → Close (อ่านข้อมูล Tutorial, Documentation, What's new ก่อนปิดได้)

วิธีติดตั้ง Python บน Windows 10 วิธีติดตั้ง Python บน Windows 10 วิธีติดตั้ง Python บน Windows 10 วิธีติดตั้ง Python บน Windows 10

ตั้งค่า System PATH Variable

เพื่อให้เรียก Python จากทุกที่ ต้องเพิ่ม Path:

  1. เปิด Control Panel
  2. ค้นหา Environment → Edit the System Environment Variables → New (ถ้ามี Path แล้วเลือก Edit)
  3. Variable name: PATH
    Variable value:
    C:\Python36-32;C:\Python36-32\Lib\site-packages;C:\Python36-32\Scripts
  4. OK และปิดหน้าต่างทั้งหมด

วิธีติดตั้ง Python บน Windows 10 วิธีติดตั้ง Python บน Windows 10

ทดสอบ Python Interpreter

  1. เปิด Command Prompt: Win + R → พิมพ์ cmd → Enter
  2. พิมพ์ python Enter → จะเข้าสู่ Python Interpreter (พร้อมพิมพ์โค้ด Python)
  3. ออกได้ด้วย exit() Enter

สรุป

ติดตั้ง Python บน Windows ง่ายมาก ใช้เวลาไม่กี่นาที หากมีปัญหา แจ้งได้ในความคิดเห็นครับ