官僚主義のため、誰かがLinuxサーバーでbashスクリプトを実行して出力を提供できるようにすることができますが、そこにログインできないか、スクリプトを直接実行できない状況に直面しました。
問題のサーバーがDebianまたはUbuntuを実行していると確信しています。
python
どのバージョンがインストールされているのか、どのバージョンがインストールされているのかを知りたいですg++
。
これまでの最良のアイデアは、$PATH
変数を取得して分割し、すべてのパスで:
一致するpython
ものを個別に検索することですg++
。
よりスマートな方法がありますか?
ベストアンサー1
g++ をローカルにインストールしていない場合は、次は g++ で動作します。
dpkg -l 'g++*'
私のシステムは以下を提供します。
dpkg -l 'g++*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-================================-=====================-=====================-======================================================================
ii g++ 4:4.9.2-2 amd64 GNU C++ compiler
ii g++-4.6 4.6.3-14 amd64 GNU C++ compiler
un g++-4.6-multilib <none> <none> (no description available)
ii g++-4.9 4.9.2-10 amd64 GNU C++ compiler
ii g++-4.9-multilib 4.9.2-10 amd64 GNU C++ compiler (multilib files)
ii g++-multilib 4:4.9.2-2 amd64 GNU C++ compiler (multilib files)
Pythonの場合、同様のアプローチはあまりにも多くの誤った肯定を提供します。だからDebianとその派生バージョンでは、すべてのPythonライブラリがpython-
。
それはまるで
dpkg -l 'python?.?'
動作する必要があります。
dpkg -l 'python?.?'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-================================-=====================-=====================-======================================================================
ii python2.6 2.6.8-1.1 amd64 Interactive high-level object-oriented language (version 2.6)
ii python2.7 2.7.9-2 amd64 Interactive high-level object-oriented language (version 2.7)
un python3.1 <none> <none> (no description available)
ii python3.4 3.4.2-1 amd64 Interactive high-level object-oriented language (version 3.4)