如何解决Jupyter Notebook安装Nervana Aeon时的CMAKE_C_COMPILER错误
Hey there, let's work through this compiler issue you hit while installing Nervana Aeon. The error messages make it clear: CMake can't find your C/C++ compilers (cl and clang++) because your Jupyter Notebook terminal isn't running in an environment that has access to Visual Studio's build tools. Here's how to fix it:
1. Use the Visual Studio Command Prompt (Simplest Solution)
Windows requires you to run CMake commands in a shell that has the Visual Studio compiler environment set up. The easiest way is to use the official Visual Studio Command Prompt:
- Open your Start Menu and search for x64 Native Tools Command Prompt for Visual Studio [your version] (e.g., "x64 Native Tools Command Prompt for VS 2022").
- Navigate to your
aeondirectory usingcdcommands (same path you used in Jupyter). - Re-run your installation commands, making sure to fix the last
pip3 installcommand (you missed the.to install from the current build directory):pip3 install -r requirements.txt mkdir -p build && cd build cmake .. pip3 install .
This command prompt automatically runs vcvarsall.bat, which sets up all the environment variables CMake needs to find the cl compiler.
2. Manually Specify Compiler Paths (If You Prefer Jupyter)
If you want to keep working in Jupyter Notebook, you can tell CMake exactly where your Visual Studio compiler is located:
- First, find the full path to
cl.exeon your system. For Visual Studio 2022 Community Edition, it's usually something like:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\cl.exe
(Adjust the version number and edition to match your installed Visual Studio.) - Modify your CMake command to include the compiler paths:
mkdir -p build && cd build cmake .. -DCMAKE_C_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe" pip3 install .
3. Verify You Have the Right Visual Studio Components
If you still get errors, double-check that you installed the C++ development tools in Visual Studio:
- Open the Visual Studio Installer and select "Modify" for your installed Visual Studio version.
- Make sure the Desktop development with C++ workload is checked (this includes the
clcompiler and other necessary build tools). - Click "Modify" to install any missing components.
内容的提问来源于stack exchange,提问作者Moona

