Skip to content

Commit e979d59

Browse files
authored
doc: Declare that node-gyp is Python 3 compatible
NOTE: node-gyp is compatible with both Python 2.7 and 3.7 but Node.js itself is not yet compatible with Python 3. Careful review please because I am not a Windows user.
1 parent 7e81270 commit e979d59

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@ $ npm install -g node-gyp
2525

2626
You will also need to install:
2727

28+
NOTE: node-gyp is compatible with Python 2.7 and 3.7 but node itself is not yet compatible with Python 3.
29+
2830
### On Unix
2931

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)
3133
* `make`
3234
* A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)
3335

3436
### On macOS
3537

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)
3739
* [Xcode](https://developer.apple.com/xcode/download/)
3840
* You also need to install the `Command Line Tools` via Xcode. You can find this under the menu `Xcode -> Preferences -> Locations` (or by running `xcode-select --install` in your Terminal)
3941
* This step will install `gcc` and the related toolchain containing `make`
4042

4143
### On Windows
4244

45+
Install the current version of Python from the [Microsoft Store package](https://docs.python.org/3.7/using/windows.html#the-microsoft-store-package).
46+
4347
#### Option 1
4448

4549
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).
@@ -50,7 +54,6 @@ Install tools and configuration manually:
5054
* Install Visual C++ Build Environment: [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools)
5155
(using "Visual C++ build tools" workload) or [Visual Studio 2017 Community](https://visualstudio.microsoft.com/pl/thank-you-downloading-visual-studio/?sku=Community)
5256
(using the "Desktop development with C++" workload)
53-
* 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.)
5457
* Launch cmd, `npm config set msvs_version 2017`
5558

5659
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.
@@ -63,15 +66,15 @@ If you have multiple Python versions installed, you can identify which Python
6366
version `node-gyp` uses by setting the `--python` variable:
6467

6568
``` bash
66-
$ node-gyp --python /path/to/python2.7
69+
$ node-gyp --python /path/to/executable/python
6770
```
6871

6972
If `node-gyp` is called by way of `npm`, *and* you have multiple versions of
7073
Python installed, then you can set `npm`'s 'python' config key to the appropriate
7174
value:
7275

7376
``` bash
74-
$ npm config set python /path/to/executable/python2.7
77+
$ npm config set python /path/to/executable/python
7578
```
7679

7780
## How to Use
@@ -120,7 +123,7 @@ JSON-like format. This file gets placed in the root of your package, alongside
120123

121124
A barebones `gyp` file appropriate for building a Node.js addon could look like:
122125

123-
``` python
126+
```python
124127
{
125128
"targets": [
126129
{
@@ -180,7 +183,7 @@ Some additional resources for addons and writing `gyp` files:
180183
| `--proxy=$url` | Set HTTP proxy for downloading header tarball
181184
| `--cafile=$cafile` | Override default CA chain (to download tarball)
182185
| `--nodedir=$path` | Set the path to the node source code
183-
| `--python=$path` | Set path to the Python 2 binary
186+
| `--python=$path` | Set path to the Python binary
184187
| `--msvs_version=$version` | Set Visual Studio version (Windows only)
185188
| `--solution=$solution` | Set Visual Studio Solution version (Windows only)
186189

0 commit comments

Comments
 (0)