Skip to content

Commit 04ce59f

Browse files
sam-githubrvagg
authored andcommitted
doc: clarify Python configuration, etc
Clarify that: - node-gyp is not used to build Node.js - PYTHON can be used to add a Python search path - NODE_GYP_FORCE_PYTHON can be used to override all Python search paths - That a compatible Python is searched for PR-URL: #1908 Reviewed-By: Christian Clauss <[email protected]> Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: João Reis <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 01c46ee commit 04ce59f

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# `node-gyp` - Node.js native addon build tool
22

3-
`node-gyp` is a cross-platform command-line tool written in Node.js for compiling
4-
native addon modules for Node.js. It bundles the [gyp](https://gyp.gsrc.io)
5-
project used by the Chromium team and takes away the pain of dealing with the
6-
various differences in build platforms.
3+
`node-gyp` is a cross-platform command-line tool written in Node.js for
4+
compiling native addon modules for Node.js. It contains a fork of the
5+
[gyp](https://gyp.gsrc.io) project that was previously used by the Chromium
6+
team and takes away the pain of dealing with the various differences in build
7+
platforms.
8+
9+
Note that `node-gyp` is _not_ used to build Node.js itself.
710

811
Multiple target versions of Node.js are supported (i.e. `0.8`, ..., `4`, `5`, `6`,
912
etc.), regardless of what version of Node.js is actually installed on your system
@@ -25,6 +28,10 @@ $ npm install -g node-gyp
2528

2629
You will also need to install:
2730

31+
NOTE: node-gyp is compatible with Python v2.7, v3.5, v3.6, or v3.7. If the
32+
Python to use is not explicitly configured (see "Configuring Python Dependency"
33+
below) it will attempt to find a compatible Python executable.
34+
2835
### On Unix
2936

3037
* `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported)
@@ -73,6 +80,14 @@ value:
7380
$ npm config set python /path/to/executable/python2.7
7481
```
7582

83+
If the `PYTHON` environment variable is set to the path of a Python executable,
84+
it will be used if it is a compatible Python.
85+
86+
If the `NODE_GYP_FORCE_PYTHON` environment variable is set to the path of a
87+
Python executable, it will be used instead of any of the other configured or
88+
builtin Python search paths. If its not a compatible Python, no further
89+
searching will be done.
90+
7691
## How to Use
7792

7893
To compile your native addon, first go to its root directory:

0 commit comments

Comments
 (0)