相关疑难解决方法(0)

#!/bin/sh 是否被解释器读取?

bashor 中sh,我想任何以 开头的#都是注释

但是在bash脚本中我们写:

#!/bin/bash
Run Code Online (Sandbox Code Playgroud)

在 Python 脚本中,有:

#!/bin/python
Run Code Online (Sandbox Code Playgroud)

这是否意味着它#本身是一个评论而#!不是?

python bash scripts

71
推荐指数
3
解决办法
3万
查看次数

shebang中哪种类型的路径更可取?

在脚本中,第一行应该指定解释器的路径。
但是在 Linux、Unix 或 BSD 的不同服务器上,此路径可能不同。

什么更可取?

#!/usr/bin/env bash 
Run Code Online (Sandbox Code Playgroud)

或者

#!/bin/bash 
Run Code Online (Sandbox Code Playgroud)

scripts shebang

22
推荐指数
2
解决办法
6355
查看次数

为什么在shebang中使用env?

#!/usr/bin/env <sh|bash|python>#!/bin/bash,#!/bin/sh或相比,使用shebang的目的是什么#!/usr/bin/python

command-line bash environment

19
推荐指数
1
解决办法
2248
查看次数

为什么 find 命令会在 /run/ 中爆炸?

我使用以下命令来检查此答案给出的 python 版本。除了一个错误外,它确实有效,如下所示。任何人都可以解释为什么?

$ sudo find / -type f -executable -iname 'python*' -exec file -i '{}' \; \
    | awk -F: '/x-executable; charset=binary/ {print $1}' \
    | xargs readlink -f | sort -u | xargs -I % sh -c 'echo -n "%: "; % -V'
Run Code Online (Sandbox Code Playgroud)

错误:

find: ‘/run/user/1000/gvfs’: Permission denied
Run Code Online (Sandbox Code Playgroud)

permissions find

13
推荐指数
2
解决办法
7078
查看次数

为什么 Netbeans 没有检测到 Python?

我在我的系统 14.04 LTS 中使用 Netbeans IDE 8.0。

我已经按照此链接在 Netbeans 8.0 中安装了 Python 插件。

我也python-3.4.1.tgz从这个链接下载并在终端中安装如下,

tar -xvf Python-3.4.1.tgz
cd Python-3.4.1/
./configure
make
sudo make install
./python
Run Code Online (Sandbox Code Playgroud)

我终于得到了结果,

arul@arul-Aspire-5740:~/Python-3.4.1$ ./python
Python 3.4.1 (default, Sep 19 2014, 17:14:45) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Run Code Online (Sandbox Code Playgroud)

我在终端中使用以下命令确认

python3 -V
Run Code Online (Sandbox Code Playgroud)

得到了回应,

Python 3.4.1
Run Code Online (Sandbox Code Playgroud)

但是,当我单击Auto DetectPython 平台管理器(Netbeans IDE 8.0.1)时,列表中没有 3.4.1(如下所示)。

在此处输入图片说明

如何解决?

更新 1

我试过,

 arul@arul-Aspire-5740:~$ sudo find / -type f -executable …
Run Code Online (Sandbox Code Playgroud)

python netbeans

6
推荐指数
1
解决办法
4415
查看次数