If you're not very familiar with computer technology but need to use some AI-related software (such as video translation, voice cloning, text-to-image, etc.), you may need to install Python on your computer. Python is a programming language that many AI software programs rely on to run. This article will guide you step-by-step through installing Python 3.10.4 on Windows 10 and setting up a basic environment to run these programs.
Why Python 3.10.4?
Because it's a relatively stable version:
- Versions older than 3.10 may no longer be supported by some software.
- Newer versions (like 3.11 or 3.13) might be too recent, causing incompatibility with model modules.
Step 1: Download Python 3.10.4
Open your browser: Use your preferred browser, type the following address into the address bar, and press Enter to open the download page:
https://www.python.org/downloads/release/python-3104/
Find the download link: Scroll down the page until you see the "Files" section. Find the line that says "Windows installer (64-bit)" and click to download it (the downloaded file will be named
python-3.10.4-amd64.exe).
Save the file: The download will start automatically, and the file will be saved to your "Downloads" folder (usually in
C:\Users\YourUsername\Downloads).
Step 2: Install Python 3.10.4
Start the installation: Locate the downloaded
python-3.10.4-amd64.exefile and double-click it. The installation window will appear.- Important: At the bottom of the window, check the box that says "Add Python 3.10 to PATH" and then click "Install Now".

Wait for the installation to complete: The installation process may take a few minutes. Once finished, you will see a "Setup was successful" message. Click "Close" to exit the installer.
Step 3: Verify the Python Installation
Open the Command Prompt (CMD): Press the Windows key + R on your keyboard. The "Run" window will pop up. Type
cmdinto the input box and press Enter. This will open a black command-line window.

Check Python version: In the command-line window, type the following and press Enter:
shpython --version
If you see output similar to
Python 3.10.4, congratulations, the installation was successful! If you see no response or an error, it's likely that you didn't check the "Add Python 3.10 to PATH" option during installation. You'll need to reinstall Python, making sure to check this box.
Step 4: Create a Virtual Environment
A virtual environment is like an isolated "small room" that allows different AI projects to use different software versions, preventing conflicts. We'll use Python's built-in venv module to create it.
Choose a folder: For example, you can create a folder on your D drive to store your projects. It's recommended to use a folder name that consists of English letters or numbers, without Chinese characters, spaces, or special symbols. For example,
D:/AIProject.Navigate to the folder and open the command prompt: Navigate to
D:/AIProjectin File Explorer, typecmdin the address bar, and press Enter to open a terminal in that directory.

Create the virtual environment: In the command prompt you just opened, type:
shpython -m venv myenv
After pressing Enter, a subfolder named
myenvwill appear in your folder. This is your virtual environment.Activate the virtual environment: Type the following command and press Enter:
shmyenv\Scripts\activate
If successful, you'll see
(myenv)at the beginning of the command line, indicating that you've entered the virtual environment.
Step 5: Install Dependencies in the Virtual Environment
Let's say you have an AI model project with a requirements.txt file (usually a list of dependencies provided by the software author). We'll install it now.
Ensure the file is in the correct location: Copy the
requirements.txtfile to your "AIProject" folder.Install dependencies: In the activated virtual environment (the command line shows
(myenv)), type:shpip install -r requirements.txtThis will automatically download and install all the packages listed in the file.

Troubleshooting common issues:
Network errors: If you see "Connection timed out" or "Download failed", it may be a network problem. Try switching to a different network or trying again. You can also add a domestic mirror to speed up the download by typing:
shpip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simpleDependency conflicts: If you see a message indicating that a package version is incompatible, try updating pip:
shpip install --upgrade pipThen, rerun the installation command. If the problem persists, contact the software author and ask about compatible versions.
Step 6: Install PyTorch (Supports CUDA 12.4)
If you have an NVIDIA graphics card and have installed CUDA 12.4 or higher (if not, skip this section and refer to other tutorials to install CUDA), you can use the following steps to install GPU-enabled PyTorch.
Check virtual environment activation: Make sure the command line shows
(myenv).Install PyTorch: Type the following command and press Enter:
shpip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124If you have installed a CUDA version greater than 12.4, you can change
cu124in the above command tocu126. If it's lower than 12.1, you can change it tocu118.torchis the main PyTorch library,torchvisionhandles images, andtorchaudiohandles audio.--index-urlspecifies the download address for the CUDA 12.4 version.Verify the installation: Type the following command:
shpython -c "import torch;print(torch.__version__);print(torch.cuda.is_available())"
If the output is similar to
2.6.0(version number) andTrue, the installation was successful and the GPU is available. If it'sFalse, check if CUDA is installed correctly. If it showsNo module named 'torch', thetorchinstallation in the previous command failed.
Note: Requires an NVIDIA graphics card and a CUDA 12.4 environment. If you don't have these, you can use the CPU version with the following command:
pip install torch torchvision torchaudioFinally: Run Your AI Software
Now your environment is set up! If your AI software has specific instructions for running it (e.g., python run.py), enter the corresponding command in the virtual environment.
