@@ -466,6 +466,45 @@ the base system and these steps will not be necessary.
466
466
.. _conda environment : https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
467
467
.. _Miniforge3 : https://github.com/conda-forge/miniforge#miniforge3
468
468
469
+ Alternative compilers
470
+ =====================
471
+
472
+ The following command will build scikit-learn using your default C/C++ compiler.
473
+
474
+ .. prompt :: bash $
475
+
476
+ pip install --verbose --editable .
477
+
478
+ If you want to build scikit-learn with another compiler handled by ``setuptools ``,
479
+ use the following command:
480
+
481
+ .. prompt :: bash $
482
+
483
+ python setup.py build_ext --compiler=<compiler> -i build_clib --compiler=<compiler>
484
+
485
+ To see the list of available compilers run:
486
+
487
+ .. prompt :: bash $
488
+
489
+ python setup.py build_ext --help-compiler
490
+
491
+ If your compiler is not listed here, you can specify it through some environment
492
+ variables (does not work on windows). This `section
493
+ <https://setuptools.pypa.io/en/stable/userguide/ext_modules.html#compiler-and-linker-options> `_
494
+ of the setuptools documentation explains in details which environment variables
495
+ are used by ``setuptools ``, and at which stage of the compilation, to set the
496
+ compiler and linker options.
497
+
498
+ When setting these environment variables, it is advised to first check their
499
+ ``sysconfig `` counterparts variables and adapt them to your compiler. For instance::
500
+
501
+ import sysconfig
502
+ print(sysconfig.get_config_var('CC'))
503
+ print(sysconfig.get_config_var('LDFLAGS'))
504
+
505
+ In addition, since Scikit-learn uses OpenMP, you need to include the appropriate OpenMP
506
+ flag of your compiler into the ``CFLAGS `` and ``CPPFLAGS `` environment variables.
507
+
469
508
Parallel builds
470
509
===============
471
510
0 commit comments