@@ -25,20 +25,24 @@ $ npm install -g node-gyp |
25 | 25 |
|
26 | 26 | You will also need to install: |
27 | 27 |
|
| 28 | +NOTE: node-gyp is compatible with Python 2.7 and 3.7 but node itself is not yet compatible with Python 3. |
| 29 | + |
28 | 30 | ### On Unix |
29 | 31 |
|
30 | | - * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported) |
| 32 | + * `Python v2.7 or v3.7` (v3.5 and 3.6 may work but are not currently tested) |
31 | 33 | * `make` |
32 | 34 | * A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org) |
33 | 35 |
|
34 | 36 | ### On macOS |
35 | 37 |
|
36 | | - * `python` (`v2.7` recommended, `v3.x.x` is __*not*__ supported) (already installed on macOS) |
| 38 | + * `Python v2.7 or v3.7` (v3.5 and 3.6 may work but are not currently tested) |
37 | 39 | * [Xcode](https://developer.apple.com/xcode/download/) |
38 | 40 | * You also need to install the `XCode Command Line Tools` by running `xcode-select --install`. Alternatively, if you already have the full Xcode installed, you can find them under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`. This step will install `clang`, `clang++`, and `make`. |
39 | 41 |
|
40 | 42 | ### On Windows |
41 | 43 |
|
| 44 | +Install the current version of Python from the [Microsoft Store package](https://docs.python.org/3.7/using/windows.html#the-microsoft-store-package). |
| 45 | + |
42 | 46 | #### Option 1 |
43 | 47 |
|
44 | 48 | Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global --production windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator). |
@@ -49,7 +53,6 @@ Install tools and configuration manually: |
49 | 53 | * Install Visual C++ Build Environment: [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools) |
50 | 54 | (using "Visual C++ build tools" workload) or [Visual Studio 2017 Community](https://visualstudio.microsoft.com/pl/thank-you-downloading-visual-studio/?sku=Community) |
51 | 55 | (using the "Desktop development with C++" workload) |
52 | | - * Install [Python 2.7](https://www.python.org/downloads/) (`v3.x.x` is not supported), and run `npm config set python python2.7` (or see below for further instructions on specifying the proper Python version and path.) |
53 | 56 | * Launch cmd, `npm config set msvs_version 2017` |
54 | 57 |
|
55 | 58 | If the above steps didn't work for you, please visit [Microsoft's Node.js Guidelines for Windows](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules) for additional tips. |
@@ -62,15 +65,15 @@ If you have multiple Python versions installed, you can identify which Python |
62 | 65 | version `node-gyp` uses by setting the `--python` variable: |
63 | 66 |
|
64 | 67 | ``` bash |
65 | | -$ node-gyp <command> --python /path/to/executable/python2.7 |
| 68 | +$ node-gyp <command> --python /path/to/executable/python |
66 | 69 | ``` |
67 | 70 |
|
68 | 71 | If `node-gyp` is called by way of `npm`, *and* you have multiple versions of |
69 | 72 | Python installed, then you can set `npm`'s 'python' config key to the appropriate |
70 | 73 | value: |
71 | 74 |
|
72 | 75 | ``` bash |
73 | | -$ npm config set python /path/to/executable/python2.7 |
| 76 | +$ npm config set python /path/to/executable/python |
74 | 77 | ``` |
75 | 78 |
|
76 | 79 | ## How to Use |
@@ -119,7 +122,7 @@ JSON-like format. This file gets placed in the root of your package, alongside |
119 | 122 |
|
120 | 123 | A barebones `gyp` file appropriate for building a Node.js addon could look like: |
121 | 124 |
|
122 | | -``` python |
| 125 | +```python |
123 | 126 | { |
124 | 127 | "targets": [ |
125 | 128 | { |
@@ -179,7 +182,7 @@ Some additional resources for addons and writing `gyp` files: |
179 | 182 | | `--proxy=$url` | Set HTTP proxy for downloading header tarball |
180 | 183 | | `--cafile=$cafile` | Override default CA chain (to download tarball) |
181 | 184 | | `--nodedir=$path` | Set the path to the node source code |
182 | | -| `--python=$path` | Set path to the Python 2 binary |
| 185 | +| `--python=$path` | Set path to the Python binary |
183 | 186 | | `--msvs_version=$version` | Set Visual Studio version (Windows only) |
184 | 187 | | `--solution=$solution` | Set Visual Studio Solution version (Windows only) |
185 | 188 |
|
|