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 than the full Anaconda.
This tutorial will guide you step-by-step on how to install Miniconda on Windows 10 using the official download address, 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, enter this address, and press Enter: https://www.anaconda.com/download/success#miniconda
Scroll down to the "Miniconda" section and click the Windows download link, 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 likeMiniconda3-latest-Windows-x86_64.exe
.
Install Miniconda
Double-click the downloaded file to open the installation window.
Click "Next," then agree to the license agreement (click "I Agree").
Important: On the "Advanced Options" page, check Add Miniconda3 to my PATH environment variable to use the
conda
command directly. Otherwise, you will encounter the errorconda is not recognized as an internal or external command, operable program or batch file.
Note: Some computers may warn against adding it to PATH, but ignore the warning and check the box. This is a common pitfall for beginners; without it, the commands will not work later.
- Click "Install" and wait a few minutes. Once completed, click "Finish."
Step 2: Verify Installation and Create a Python 3.10 Virtual Environment
Open the Command Prompt (CMD)
- Press the Windows key + R on your keyboard to open the "Run" window.
- Enter
cmd
and press Enter to open the black command prompt window.
Check if Miniconda is installed successfully
- Enter the following command in the command prompt:
conda --version
Press Enter. If it displays something likeconda 25.1.1
, the installation was successful.
- Enter the following command in the command prompt:
If it says "not recognized as an internal or external command," it means you didn't add the environment variable. Reinstall and check Add Miniconda3 to my PATH environment variable. 3. Create a Python 3.10 virtual environment
- Enter the following command in the command prompt:
conda create -n myai python=3.10
- myai is the name of the environment; you can name it anything 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". Enter
y
and press Enter to continue the installation.
- Activate the virtual environment
- Enter:
conda activate myai
Press Enter. If(myai)
appears before the command line, you have successfully entered the environment.
- Enter:
- Common Virtual Environment Commands
- Exit the environment: Enter
conda deactivate
and press Enter. The(myai)
will disappear when you have exited. - View all environments: Enter
conda env list
to see a list of the environments you have created. - Delete an environment (if you don't need it): Enter
conda env remove -n myai
to delete it.
- Exit the environment: Enter
Step 3: Use pip to Install Modules and requirements.txt
Make sure you are in the virtual environment
- Enter
conda activate myai
and confirm that the command line shows(myai)
.
- Enter
Install a commonly used module as a test
- For example, install
numpy
(a mathematical calculation tool that many AI software require):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 requirements.txt
- If your AI software provides a
requirements.txt
file (listing the required packages), copy it to a folder (e.g., a new "AIProject" folder on your desktop). - Enter the folder and delete the content in the folder address bar, enter
cmd
and press Enter to open the terminal window:
- If your AI software provides a
- Then enter:
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, enter
pip install --upgrade pip
to update. - List installed packages:
pip list
to see what you have installed. - Uninstall a package: For example,
pip uninstall numpy
to remove it if you don't need it.
- Check pip version:
Common Errors and Solutions
Network errors (slow download or failure):
- It could be a network issue; try again a few times or use a domestic mirror for faster downloads:
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
- It could be a network issue; try again a few times or use a domestic mirror for faster downloads:
Permission errors (Access Denied):
- Run CMD as an administrator: Right-click the "Start" menu, select "Command Prompt (Admin)," and try the command again.
- Run CMD as an administrator: Right-click the "Start" menu, select "Command Prompt (Admin)," and try the command again.
Dependency conflicts (incompatible versions):
- If you get a conflict message, try updating pip (
pip install --upgrade pip
) and then reinstalling. If that doesn't work, ask the software author for the recommended versions.
- If you get a conflict message, try updating pip (
Command not valid:
- If
pip
is not working, enterpython -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
), enter the corresponding command in the virtual environment (with (myai)
in the command line) to give it a try.