util.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:sublimeTextConfig 作者: luoye-fe 项目源码 文件源码
def find_python_script(python_path, script):
    """Return the path to the given script, or None if not found."""
    if sublime.platform() in ('osx', 'linux'):
        pyenv = which('pyenv')
        if pyenv:
            out = run_shell_cmd((os.environ['SHELL'], '-l', '-c',
                                 'echo ""; {} which {}'.format(pyenv, script))).strip().decode().split('\n')[-1]
            if os.path.isfile(out):
                return out
        return which(script)
    else:
        # On Windows, scripts may be .exe files or .py files in <python directory>/Scripts
        scripts_path = os.path.join(os.path.dirname(python_path), 'Scripts')
        script_path = os.path.join(scripts_path, script + '.exe')

        if os.path.exists(script_path):
            return script_path

        script_path = os.path.join(scripts_path, script + '-script.py')

        if os.path.exists(script_path):
            return script_path

        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号