I have python2 and python3,I run ./configure and it works.But I run make,
make -C out BUILDTYPE=Release V=1 make[1]: Entering directory `/home/colin4124/MyProgram/node/out' LD_LIBRARY_PATH=/home/colin4124/MyProgram/node/out/Release/lib.host:/home/colin4124/MyProgra>m/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /home/colin4124/MyProgram/node/out/Release/obj/gen; python ../../tools/gen-postmortem-metadata.py "/home/colin4124/MyProgram/node/out/Release/obj/gen/debug-support.cc" ../../src/objects.h ../../src/objects-inl.h Traceback (most recent call last): File "../../tools/gen-postmortem-metadata.py", line 479, in emit_config(); File "../../tools/gen-postmortem-metadata.py", line 432, in emit_config out = file(sys.argv[1], 'w'); NameError: global name 'file' is not defined make[1]: *** [/home/colin4124/MyProgram/node/out/Release/obj/gen/debug-support.cc] Error 1 make[1]: Leaving directory `/home/colin4124/MyProgram/node/out' make: *** [node] Error 2
How I can solve it,Think you!!
It looks like your default Python is 3.x, but the Node build scripts require Python 2.x.
According to these instructions you can fix it by setting the PYTHON
environment variable to point to your Python 2 executable:
export PYTHON=`which python2`
It's because your default python
is python3.x
. Node.js recommend python2.6
/ python2.7
to compile the source.
Try to check your python
command via:
ls -l /usr/bin/python
it will show lrwxrwxrwx 1 root root 9 Apr 3 15:46 /usr/bin/python -> python3
To make python2.7
as the default python
command use:
sudo ln -sf `which python2.7` `which python`
ls -l /usr/bin/python
now it should be lrwxrwxrwx 1 root root 9 Apr 3 15:46 /usr/bin/python -> python2.7
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.