GithubHelp home page GithubHelp logo

bad interpreter in OS X about zhao HOT 3 CLOSED

gaocegege avatar gaocegege commented on June 13, 2024
bad interpreter in OS X

from zhao.

Comments (3)

gaocegege avatar gaocegege commented on June 13, 2024

OS X下Python解释器默认是/usr/bin/python2.*什么的

from zhao.

programthink avatar programthink commented on June 13, 2024

@gaocegege
多谢反馈 bug
俺手头没有 Mac OS 的环境,俺这个脚本是在 Linux 上开发的,没有考虑到对 Mac OS 的兼容性。
最好能找到某种“两边都兼容”的写法

from zhao.

gaocegege avatar gaocegege commented on June 13, 2024

@programthink
我写了一个脚本,新建一个scripts目录,目录下新建build.sh:

#!/bin/sh

RED='\033[0;31m'
NC='\033[0m'

ROOT=$(dirname "${BASH_SOURCE}")/..

cd ${ROOT}/bin
if [[ $(which python1) ]]; then
    echo "Use python to build."
    $(which python) ./make.py $1
    cd - > /dev/null
    exit 1
fi
echo "${RED}Warnning${NC}: No python found, try to locate python2..."

if [[ $(which python2) ]]; then
    echo "Use python2 to build."
    $(which python2) ./make.py $1
    cd - > /dev/null
    exit 1
fi
echo "${RED}Warnning${NC}: No python2 found, try to locate python3..."

if [[ $(which python3) ]]; then
    echo "Use python3 to build."
    $(which python3) ./make.py $1
    cd - > /dev/null
    exit 1
fi
echo "${RED}Warnning${NC}: No python3 found... Abort."

用which python的方法来得到,三段逻辑重复,之后可以写的更加好看一点

from zhao.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.