Miniconda is a lightweight version of Anaconda that helps you quickly install Python and various packages, making it more suitable for beginners to run AI programs compared to the full Anaconda distribution.
This tutorial will guide you step-by-step on how to install Miniconda on Windows 10, using the official download link, configure a Python 3.10 environment, and install some commonly used modules. Don't worry, even if you have no prior experience, you can easily get it done!
Step 1: Download and Install Miniconda
Download Miniconda
Open your browser, type in this address, and press Enter: https://www.anaconda.com/download/success#miniconda
Scroll down to the "Miniconda" section, click the download link for Windows, or use this direct link: https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
The file will be saved to your "Downloads" folder (e.g.,
C:\Users\YourUsername\Downloads
), with a filename similar toMiniconda3-latest-Windows-x86_64.exe
.
Install Miniconda
Double-click the downloaded file to open the installation window.
Click "Next" to proceed and agree to the license agreement ("I Agree").
Important: On the "Advanced Options" page, check the box "Add Miniconda3 to my PATH environment variable". This allows you to use the
conda
command directly, otherwise, you might encounter the errorconda is not recognized as an internal or external command, operable program or batch file.
Note: Some computers may warn against adding to PATH, but ignore it and check the box. This is a common pitfall for beginners; if you don't check it, the commands won't work later.
- Click "Install" and wait for a few minutes. Once completed, click "Finish".
Step 2: Verify Installation and Create a Python 3.10 Virtual Environment
Open Command Prompt (CMD)
- Press and hold the Windows key + R on your keyboard to open the "Run" window.
- Type
cmd
and press Enter to open the black command-line window.
Verify Miniconda Installation
- In the command line, type:
conda --version
- Press Enter. If it displays something like
conda 25.1.1
, the installation was successful.
- In the command line, type:
If it says "not recognized as an internal or external command," reinstall and check the Add Miniconda3 to my PATH environment variable box. 3. Create a Python 3.10 Virtual Environment
- In the command line, type:
conda create -n myai python=3.10
myai
is the name of the environment, you can choose any name you like (e.g.,ai_env
).- After pressing Enter, the system will download Python 3.10 and some basic packages. During the process, it will ask "Y/N". Type
y
and press Enter to continue the installation.
- Activate the Virtual Environment
- Type:
conda activate myai
- Press Enter. If
(myai)
appears at the beginning of the command line, you have successfully entered the environment.
- Type:
- Common Virtual Environment Commands
- Exit Environment: Type
conda deactivate
and press Enter. The(myai)
will disappear, indicating you've exited. - List All Environments: Type
conda env list
to see a list of your created environments. - Delete Environment (if you don't need it): Type
conda env remove -n myai
to delete it.
- Exit Environment: Type
Step 3: Install Modules using pip and requirements.txt
Ensure You Are in the Virtual Environment
- Type
conda activate myai
and confirm that the command line shows(myai)
.
- Type
Install a Common Module to Test
- For example, install
numpy
(a mathematical computation tool required by many AI software packages):pip install numpy
Press Enter. After downloading and installing, you can check the version usingpython -c "import numpy; print(numpy.__version__)"
.
- For example, install
Install from requirements.txt
- If your AI software provides a
requirements.txt
file (listing the required packages), copy it to a folder (e.g., a new folder named "AIProject" on your desktop). - Navigate to the folder, delete the content in the address bar and type
cmd
then press Enter to open a command line window in this directory:
- If your AI software provides a
- Then type:
pip install -r requirements.txt
Press Enter, and it will automatically install all the packages listed in the file.
Step 4: Common pip Commands and Troubleshooting
Common pip Commands
- Check pip Version:
pip --version
to see if it's the latest version. - Update pip: If the version is old, type
pip install --upgrade pip
to update. - List Installed Packages:
pip list
to see what's installed. - Uninstall a Package: For example,
pip uninstall numpy
to remove it if you don't need it anymore.
- Check pip Version:
Common Errors and Solutions
Network Errors (Slow or Failed Downloads):
- It might be a network issue. Try again a few times, or use a domestic mirror to speed up the download:
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
- It might be a network issue. Try again a few times, or use a domestic mirror to speed up the download:
Permission Errors (Access Denied):
- Run CMD as administrator: Right-click on the "Start" menu, select "Command Prompt (Admin)," and try the command again.
- Run CMD as administrator: Right-click on the "Start" menu, select "Command Prompt (Admin)," and try the command again.
Dependency Conflicts (Incompatible Versions):
- If you get a conflict error for a specific package, try updating pip (
pip install --upgrade pip
) and then reinstalling. If it still doesn't work, ask the software author for the recommended version.
- If you get a conflict error for a specific package, try updating pip (
Command Not Recognized:
- If
pip
doesn't work, trypython -m ensurepip
andpython -m pip install --upgrade pip
to fix it.
- If
Now Miniconda is installed, the Python 3.10 environment is configured, and you can install various required packages. If your AI software has running instructions (e.g., python run.py
), type the corresponding command in the virtual environment (with (myai)
showing on the command line) and give it a try.