How do I install ROOT+Python in a virtual environment created by anaconda on Windows

I want to call ROOT’s interface in python, but I don’t know how to install it.
I had to use python3.6, so I used anaconda to create an environment called python36.
I saw this guide Building ROOT from source. Should I execute the following statements in cmd of my environment:

git clone --branch latest-stable --depth=1 root_src
mkdir <builddir> <installdir>
cd <builddir>
cmake -DCMAKE_INSTALL_PREFIX=<installdir> -DPython3_EXECUTABLE=<python3interpreter> -DPython2_EXECUTABLE=<python2interpreter> <sourcedir>
cmake --build . --target install [-- <options to the native tool>]
source <installdir>/bin/

_ROOT Version: ROOT6
_Platform: Windows
_Python Version: 3.6.15

Welcome to the ROOT Forum!
I’m not sure anaconda works on Windows, but in any case, to build ROOT on Windows, you should follow the instruction that are specific to Windows on this page: Building ROOT from source - ROOT

Very thank to your reply.
I now have conda and ROOT installed in linux and can run import ROOT in python after running the file
But every time I want to run python files in VScode, I need to run I think this is a little troublesome. Is there any way to set it as the default?

Perhaps you can set the script to be automatically sourced in your environment. Assuming that you are using the BASH shell, you can append the following line to your ~/.bashrc file:

source /absolute/path/to/


Wooooow, Very thank to your reply, I have solved my problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.