I am using find_package(Python3 COMPONENTS Interpreter Development)
to find python, and it can successfully find my conda python.
However, I can not change the location of python. CMake
find my conda/envA
, but I want to use conda/envB
, how can I change the location?
You must activate the environment you want to use by executing command conda activate envB
.
But, how can CMake
find conda/envB
?
When you activate your conda
environment, environment variable PATH
is updated accordingly.
Of course, you have to launch a new CMake
generation from a clean environment (i.e. no CMakeCache.txt
file in the build
directory).
I think it may work for linux?
But, I am working in win10. Even I activate my conda
environment in a cmd
, the CMake-gui
can not find it after I clear all files in build
.
It should work on Windows
.
But, if you want to edit interactively Python3
artifacts, you have to specify Python3_ARTIFACTS_INTERACTIVE
with ON
value (on the command line or in your CMakeLists.txt), see Python3 documentation, Artifacts Specification.
But anyway, why do you want to edit the artifacts? Specifying current python through conda activate
should be enough.
1 Like
You would have to launch cmake-gui
from that cmd
shell with the conda environment activated for that to work.
1 Like
Hi! I’m new here, but I’ve been using this for quite a while. You can use -DPython3_EXECUTABLE={your_python_interpreter_path}
when configuring.