You are not logged in.

#1 2017-05-12 16:55:18

stoencold111
Member
Registered: 2016-07-06
Posts: 16

Can't get a script to use python 2.7 instead of 3

I have trouble running python2 with a script.
I have been trying to run a script called node-compiler [LINK] to compile node.js scripts into a single binary file.

The document gives an example of running node-compiler, and since it requires python2.6 or 2.7, I run it this way in a shell script :

export PATH="~/bin:$PATH"
git clone --depth 1 https://github.com/jashkenas/coffeescript.git
cd coffeescript
../nodec bin/coffee

The ~/bin folder contains a "python" softlink to `/usr/bin/python2`, so that it wouldn't use python 3;

[someone@someone bin]$ ls -la
lrwxrwxrwx  1 someone users   16 Jul 12  2016 python -> /usr/bin/python2

But the node-compiler script still throws an error of python not being compatible:

......
Number of gids 1
    users (100)
-> cd /home/user/project/compiler/coffeescript
-> cd /tmp/nodec/node
-> cd /home/user/project/compiler/coffeescript
-> cd /tmp/nodec/node
-> Running ["./configure "]
Please use either Python 2.6 or 2.7:

  /usr/bin/python2 ./configure
Failed running ["./configure "]

Can anyone try the above example? How can I get the python2 to work instead of python3?

Last edited by stoencold111 (2017-05-12 17:03:21)

Offline

#2 2017-05-12 17:07:01

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: Can't get a script to use python 2.7 instead of 3


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2017-05-12 18:41:59

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,891

Re: Can't get a script to use python 2.7 instead of 3

Look at the shebang of the configure script - it'll likely be /usr/bin/python

Offline

#4 2017-05-13 00:07:01

stoencold111
Member
Registered: 2016-07-06
Posts: 16

Re: Can't get a script to use python 2.7 instead of 3

Thank you. I use python2-virtualenv and manage to get past the error.

Offline

Board footer

Powered by FluxBB