| target | python-beginner installation guide |
|---|---|
| target-audience | new entrance post-graduate students with mixed background |
| target-Language | English |
| target-platform | arm64-macos, amd64-windows, x86_64-linux |
This repo serves as tutorial for beginners to learn how to use install a python environment and use it to learn simple python lession.
- basic unix-alike system introduction, path, command line (bash, zsh)
- basic python distribution and installation on different system, virtual environment etc
- how to run codes
- how to what to put in place of --config
- never include any instructions to site developer other than "TODO"
- The reader is a beginner student, NOT the repo maintainer. Never put any
authoring/dev-operations instructions into the tutorial text (
.mdchapters that render to reader-facing pages). This includes, but is not limited to:- "edit a
.md/ refresh the page to update" type hints - "commit/push the file to git", "run
serve.py", "reload the page" instructions - any mention of the build/watch/reload workflow or repo internals
- "edit a
- Authoring notes belong only in
![TODO: ...]image placeholders or HTML comments (<!-- TODO: ... -->), which are hidden from the rendered page.readme.mdandserve.pyare maintainer docs and are exempt from this rule.
- The reader is a beginner student, NOT the repo maintainer. Never put any
authoring/dev-operations instructions into the tutorial text (
- use emoji callouts, not GitHub-style alert syntax. Never write GitHub-style alert
blocks (
> [!NOTE],> [!TIP],> [!WARNING],> [!IMPORTANT]) in any reader-facing.md. Replace them with a leading emoji on the blockquote instead:> [!NOTE]→> 📝> [!TIP]→> 💡> [!WARNING]→> ⚠️> [!IMPORTANT]→> ❗> [!CAUTION]→> ⚠️This keeps callouts visible without relying on GitHub-only rendering.
- phase1: in html format, pure html for github page and paste to html previewer
- phase2: tutorials in markdown format, with code snippets
- plan for structure, ready to distribute github page
- write first part
- write second part
- write third part
show welcome to hku students, and give a brief introduction to the repo. To better facilitate programming bootcamp students, we will provide a series of tutorials to help them learn how to install python on their pc and use it to learn simple python lessons. There are secions that can be skipped for those who have already learned the basics of programming. e.g. basic unix-alike system introduction. And why it's necessary to learn this while agents can do it for you. Also mention difference with pypy and cpython and state we use cpython
- (very short) what is command line, bash for linux, zsh for macos, recommand pwsh for windows, hot to find them on computer; how to invoke
- sudo and run as administrator, sudo password is usually your macos login password
- (short) useage of
-h,--help, with example of (very short) difference of-and--
# fyq at Mbp.lan in ~/.pi [11:06:42]
$ ls -la
# fyq at Mbp.lan in ~/.pi [11:38:03]
$ python -h
zsh: command not found: python
# fyq at Mbp.lan in ~/.pi [11:38:15]
$ python3 -h
usage: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
- why there is no
pythonon macos (with link jump to how many pythons are there on macos) - difference of Options and arguments
- why executables on windows has
exeextension and why unix does not have - pwsh commands: unix-like aliases and its original commands and why windows is not prefered. e.g.
Get-Command=which
- why need virtual env rather than standalone python, why conda is preferred (uv as a fast alternative). why /usr/bin/python3 cannot be used directly
- conda:https://www.anaconda.com/docs/getting-started/concepts/anaconda-or-miniconda
- anaconda (full distribution: conda + 250+ pre-installed packages, ~3 GB) and miniconda (minimal installer: conda only, ~100 MB), difference of channels, conda-forge and others
- uv:https://docs.astral.sh/uv/ (fast alternative)
- difference of
condaanduv,conda activatevssource .venv/bin/activate, global vs local enviroment
-
how to choose specific, concrete versions — a fixed Python version (e.g. 3.12), the exact CPU arch (amd64, arm64, x86_64, aarch64), and the exact installer version number for Anaconda/Miniconda. Never write "latest" or leave the version blank. Then how to set up first python enviroment
-
standalone installation, double click exe to install
- win:
- https://www.python.org/downloads/windows/
- typecially it will be installed under the path of
- macos:
- with standalone installer, is should be need to add path mannually?: https://www.python.org/downloads/macos/
- with brew:
brew install python@3.12 - typecially it will be installed under the path of
- linux:
- with apt/yum/pacman:
apt install python? - with standalone installer:https://www.python.org/downloads/source/
- typecially it will be installed under the path of
- with apt/yum/pacman:
- win:
-
with conda (two distributions — pick one):
- Anaconda (full distribution: conda + 250+ pre-installed packages, ~3 GB) — official install docs:
- Miniconda (minimal installer: conda only, no pre-installed packages — recommended) — official install docs:
- how to install (same for both distributions)
- introduce cli reference
conda create --name py310 python=3.12 conda activate <enviroment name>and how to re-activate after close terminal- how to set specific pre-installed python executable for new env to save space
- introduce cli reference
-
with uv:
- url: https://docs.astral.sh/uv/getting-started/installation/#pypi
- how to install
- curl, brew, winget (from url)
uv install pythonuv init,uv pip install pandas, anduv runand how to re-activate after close terminal- how to set specific pre-installed python executable for new env to save space
copy this command to your terminal and run it
python3 -c "import sys; print(sys.executable)"it might return /Applications/Xcode.app/Contents/Developer/usr/bin/python3 which differs from what you have installed, explain why and how to fix it. might be path issue.
- find the correct executable path
- put into .zshrc or activate virtual env
- https://www.anaconda.com/docs/getting-started/working-with-conda/ides/pycharm#creating-a-new-conda-environment-from-a-pycharm-project
- https://www.anaconda.com/docs/getting-started/working-with-conda/ides/vscode
- https://www.anaconda.com/docs/getting-started/working-with-conda/ides/python-path
how to use can refer to command line part above
- github copilot, student subscription:
- opencode series: opencode, kilo, mimo
- commands should be seperated per system type, should be ready to paste and execute
- so the code block should not have copyable
$which will mislead the reader