Setting Up From Scratch — Anaconda + PyCharm + PyTorch (GPU) + Virtual Environment (Complete Steps)

1. Installing Anaconda

Go to the Enaconda download page and click Download.

Download the installer and proceed with the installation.

Set the installation path to all English characters.

Uncheck the second option.

Next, configure the environment variables.

Based on your custom installation path, add the following three paths:

  • path/to/anaconda
  • path/to/anaconda/Scripts
  • path/to/anaconda/Library/bin

Drag the following icons from the Start Menu to the Desktop for easier access later.


2. Installing PyCharm

First, go to the PyCharm official website, click the Download button to download the installer.

I prefer the Community edition (because it's free). Click Download and wait for the download to complete.

Once downloaded, double-click the installer to begin the installation.

Set a custom installation path, preferably one that is self-explanatory.

Select all options — you'll need them all.

If you want to restart you're computer, check the first option. If not, check the second option. (Recommendation: Restart — consider it a break!)


3. Creating Virtual Environment and Installing PyTorch

Open Anaconda Prompt.

Create a virtual environment (set your own virtual environment name):

conda create -n myenv python=3.9

When prompted with a large block of text, type the letter y and press Enter.

Activate the virtual environment:

conda activate myenv

Before creating the PyTorch environment, install some common packages to improve speed later:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy==1.26.4
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow==9.5.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tqdm

Create the PyTorch environment. If it fails, try again — it might be due to network issues.

Tested and working on April 6, 2024 at 13:28! Tested and working on May 11, 2024 at 16:58! Tested and working on June 23, 2024 at 12:48! Tested and working on November 15, 2024 at 20:02! Tested and working on May 16, 2025 at 19:20!

pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 -f https://download.pytorch.org/whl/torch_stable.html

4. Linking Virtual Environment

Double-click PyCharm on the desktop to open it.

You will see the English interface. If you prefer Chinese, you can switch the language.

Click Restart IDE to restart PyCharm.

After restarting, you will see the familiar interface.

Next, link PyCharm with the virtual environment in Anaconda. Click New Project.

You can set the project location yourself.

There should be two environments:

  • The first environment is the base environment — do not modify it!
  • Select the second user-created virtual environment and click Create.

Create a .py file and enter the following code for testing:

import torch

print(torch.__version__)
print(torch.cuda.is_available())

Right-click anywhere in the blank space of the code and run this file.

The final result should look like this, indicating that PyTorch has been successfully installed. You can now continue learning with confidence!


Expected Output:

1.12.0+cu113
True

If you see True for the CUDA availability check, your GPU support is properly configured and ready to use!

Tags: anaconda pycharm pytorch gpu Virtual Environment

Posted on Sat, 05 Sep 2026 16:13:55 +0000 by tili