Skip to content

Why Install Visual Studio Community?

You may have heard of Visual Studio, hailed as the "Universe's No. 1 IDE" (Integrated Development Environment), known for its powerful features. However, it's also quite "large." For those who don't specialize in .NET development, installation is usually unnecessary.

But! If you frequently need to try running open-source AI projects (such as Python-based projects) on your Windows computer, installing Visual Studio Community becomes almost essential. This is because many Python libraries (referred to as "dependencies") require a "compilation" step on your computer during installation, which utilizes Microsoft's C++ compilation tools (MSVC for short). If you don't have MSVC environment installed on your computer, installing these Python libraries will fail, displaying error messages similar to the following:

Example 1 of errors caused by missing MSVC compilation environment

Example 2 of errors caused by missing MSVC compilation environment

Fortunately, the easiest and most recommended way to install the MSVC compilation environment is to install the free Visual Studio Community version. Let's see how to do it below.

Step 1: Download the Visual Studio Installer

  1. Open your browser and visit this address: https://visualstudio.microsoft.com/zh-hans/free-developer-offers/
  2. On the page, find the Visual Studio Community area and click the "Free Download" button below it.

Click the "Free Download" button below "Visual Studio Community"

  1. After the download is complete, locate the downloaded .exe file (usually starting with VisualStudioSetup or similar), and double-click to run it.

Double-click the downloaded .exe installation file

  1. A small prompt window may pop up, click "Continue". The installer will prepare for a while.
  2. Next, you will see the main interface of Visual Studio Installer. It displays different Visual Studio versions available for installation. Make sure you are under the "Available" tab and find the option with Visual Studio Community (such as Visual Studio Community 2022). This version is completely free, other versions (such as Professional or Enterprise) require payment. Choose the latest Community version (such as 2022 or a later version), and click the "Install" button corresponding to it.

In the "Available" list, select the free version with "Visual Studio Community" and click "Install"

Step 2: Select the Components to Install

After clicking "Install", you will enter a more detailed settings interface, allowing you to select the specific features you need to install, which are called "Workloads".

  1. In this interface, scroll down and find the large category named "Desktop & Mobile Development".
  2. Under this category, find and check the "Desktop development with C++" option. This is the key to installing the MSVC compilation environment.
  3. After checking "Desktop development with C++", look at the right side of the window, there will be an "Installation details" area, listing the specific components to be installed. Most of the necessary components have been automatically checked.
  4. (Important suggestion) In the "Installation details" on the right, find and additionally check those options with names containing "Build Tools" and "MSVC v14x ... Build Tools" (such as v140, v141, v142, v143, etc.). As shown in areas 4, 5, and 6 in the red box in the figure below (the specific numbers and versions may vary slightly, the key is to look at the names).

Check the "Desktop development with C++" workload, and additionally check multiple MSVC build tool versions on the right

**Why select these additional items?** Because some older Python projects may depend on specific versions of the MSVC compiler. To avoid compilation errors caused by missing a certain version in the future, it is recommended to select the build tools for several major MSVC versions (v142, v143, etc.) here. Doing so will only take up a little more hard drive space, but it can save a lot of trouble in the future.
  1. After confirming that the selection is correct, click the "Install" button in the lower right corner of the interface.

Step 3: Wait for the Installation to Complete

Now, the installer will begin downloading and installing all the components you selected. This process takes some time, depending on your network speed and computer performance, please be patient.

The installer will prompt you when the installation is successful. Then you can close the Visual Studio Installer.

Alright, Visual Studio Community (and the most important C++ compilation environment) has been successfully installed on your computer! Now, go back to the pip install command that previously reported an error due to missing MSVC, and try running it again, it should pass smoothly this time!