Machine Learning Academy · บทเรียน

การติดตั้ง Anaconda และ Jupyter Notebook

ผู้เรียนจะติดตั้ง Anaconda สร้างสภาพแวดล้อม conda เฉพาะ เปิดใช้งาน Jupyter และตรวจสอบว่าการพึ่งพาทั้งหมดของการเรียนรู้ของเครื่องพร้อมใช้งาน

บทเรียน 1 จาก 413 ขั้นตอน

การติดตั้ง Anaconda และ Jupyter Notebook เป็นบทเรียน Machine Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Machine Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Machine Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Why Anaconda for Machine Learning?

Anaconda bundles Python and 250+ science packages, so you go from a blank machine to a working ML setup in minutes. Its big win: isolated environments per project. 🐍

Downloading and Installing Anaconda

Grab Anaconda for your OS from anaconda.com (it's a big download — the full science stack). Then open a fresh terminal and run conda --version to confirm it worked.

# Verify installation in terminal (not Python)
# conda --version
# Output: conda 23.11.0

# Also verify Python
# python --version
# Output: Python 3.11.x

Creating a Dedicated Conda Environment

Give every project its own environment so you can experiment freely without breaking anything else. Create it, activate it, and all your installs stay neatly inside.

# Run these commands in your terminal

# Create a new environment named 'ml_course' with Python 3.11
# conda create -n ml_course python=3.11

# Activate the environment
# conda activate ml_course

# Your prompt will change to show (ml_course)
# All pip/conda installs now go into this environment only

# Deactivate when done
# conda deactivate

Installing the ML Stack

Now install your toolkit: scikit-learn for ML, NumPy and Pandas for data, Matplotlib for charts, Jupyter for notebooks. Prefer conda install for science packages.

# Install all core ML packages in one command
# conda install -n ml_course numpy pandas scikit-learn matplotlib seaborn jupyter

# Or use pip if you prefer
# pip install numpy pandas scikit-learn matplotlib seaborn notebook

# Verify in Python
import numpy as np
import pandas as pd
import sklearn
print('numpy:', np.__version__)
print('pandas:', pd.__version__)
print('sklearn:', sklearn.__version__)

Launching Jupyter Notebook

Jupyter Notebook is a browser tool where code, results, and notes live in one document. Run jupyter notebook, then run any cell with Shift+Enter. It's the ML playground.

# In terminal (after conda activate ml_course):
# jupyter notebook

# This opens http://localhost:8888 in your browser
# Create a new notebook and run this test cell:

import numpy as np
import pandas as pd

print('Environment is working!')
print('NumPy array:', np.array([1, 2, 3]) * 2)

JupyterLab: The Modern Alternative

JupyterLab is the modern upgrade: file browser, tabs, and a terminal in one window. Same .ipynb files, nicer interface — many people have switched to it.

# Install JupyterLab
# pip install jupyterlab

# Launch JupyterLab
# jupyter lab

# Key JupyterLab shortcuts:
# Shift+Enter  -> run cell and move to next
# Ctrl+Enter   -> run cell, stay on same cell
# A            -> insert cell above (command mode)
# B            -> insert cell below (command mode)
# M            -> convert cell to Markdown
# D, D         -> delete cell

Essential Jupyter Notebook Tips

A few habits keep notebooks tidy: use Restart and Run All to catch out-of-order bugs, add markdown notes, and keep one idea per cell. Small habits, big payoff. ✨

# Useful magic commands in Jupyter

# Show all variables in memory
# %who

# Time how long a cell takes to run
# %time sum(range(1_000_000))

# See a matplotlib plot inline (no extra plt.show() needed)
# %matplotlib inline

# Reload external modules automatically when they change
# %load_ext autoreload
# %autoreload 2

Managing Environments with conda

As projects pile up, conda helps you manage them — list, update, or remove environments. You can even export one to a YAML file so teammates recreate it exactly.

# List all conda environments
# conda env list

# Export current environment to YAML
# conda env export > environment.yml

# Create environment from YAML (for teammates)
# conda env create -f environment.yml

# Remove an environment you no longer need
# conda env remove -n old_project

# Update a package
# conda update scikit-learn

VS Code as an Alternative to Jupyter

Prefer an IDE? VS Code runs .ipynb notebooks too, with autocomplete, debugging, and Git built in. It auto-detects your conda environments as kernels.

Verifying the Full Stack Works

Before any project, run a quick sanity check: import every package and confirm it loads. Sixty seconds now saves hours of mystery import errors later. The code does it.

# Full stack verification cell
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler

# Quick smoke test
X = np.random.randn(100, 2)
y = X[:, 0] * 2 + np.random.randn(100) * 0.1

model = LinearRegression()
model.fit(X, y)
print('All imports OK. Model trained successfully.')
print('Coefficient 0:', round(model.coef_[0], 2))  # should be ~2.0

Google Colab: ML in the Browser

Don't want to install anything? Google Colab gives you free Jupyter notebooks in the cloud, with libraries ready and optional free GPUs. Great for learning and sharing.

Quick Check

Test your understanding of Machine Learning with Python concepts from this lesson.

Lesson Recap

You set up a full ML toolkit: conda environments keep projects isolated, Jupyter gives you interactive notebooks, and a quick check confirms everything's ready. Next: NumPy. 🎉

เริ่มต้นได้ฟรี

เรียนรู้ Python ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
30
บทเรียน
120

คำถามที่พบบ่อย

บทเรียน “การติดตั้ง Anaconda และ Jupyter Notebook” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การติดตั้ง Anaconda และ Jupyter Notebook” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Machine Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Machine Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การติดตั้ง Anaconda และ Jupyter Notebook”

ผู้เรียนจะติดตั้ง Anaconda สร้างสภาพแวดล้อม conda เฉพาะ เปิดใช้งาน Jupyter และตรวจสอบว่าการพึ่งพาทั้งหมดของการเรียนรู้ของเครื่องพร้อมใช้งาน คุณปฏิบัติ Machine Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Machine Learning Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Machine Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

บทเรียน “การติดตั้ง Anaconda และ Jupyter Notebook” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Machine Learning Academy นี้ได้ไหม

ได้ บทเรียน Machine Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. การติดตั้ง Anaconda และ Jupyter Notebook
  2. พื้นฐาน NumPy: อาร์เรย์และการดำเนินการทางคณิตศาสตร์
  3. Pandas สำหรับการจัดการข้อมูล
  4. การแสดงภาพข้อมูลด้วย Matplotlib และ Seaborn
← กลับไปที่ Machine Learning Academy