您好,登錄后才能下訂單哦!
這篇文章主要為大家展示了“怎么在Linux中不安裝軟件測試一個軟件包”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“怎么在Linux中不安裝軟件測試一個軟件包”這篇文章吧。
出于某種原因,你可能需要在將軟件包安裝到你的 Linux 系統(tǒng)之前對其進(jìn)行測試。如果是這樣,你很幸運(yùn)!今天,我將向你展示如何在 Linux 中使用 Nix 包管理器來實(shí)現(xiàn)。Nix 包管理器的一個顯著特性是它允許用戶測試軟件包而無需先安裝它們。當(dāng)你想要臨時使用特定的程序時,這會很有幫助。
確保你先安裝了 Nix 包管理器。如果尚未安裝,請參閱以下指南。
例如,假設(shè)你想測試你的 C++ 代碼。你不必安裝 GCC。只需運(yùn)行以下命令:
$ nix-shell -p gcc
該命令會構(gòu)建或下載 gcc 軟件包及其依賴項(xiàng),然后將其放入一個存在 gcc
命令的 Bash shell 中,所有這些都不會影響正常環(huán)境。
LANGUAGE = (unset),LC_ALL = (unset),LANG = "en_US.UTF-8"are supported and installed on your system.perl: warning: Falling back to the standard locale ("C").download-using-manifests.pl: perl: warning: Setting locale failed.download-using-manifests.pl: perl: warning: Please check that your locale settings:download-using-manifests.pl: LANGUAGE = (unset),download-using-manifests.pl: LC_ALL = (unset),download-using-manifests.pl: LANG = "en_US.UTF-8"download-using-manifests.pl: are supported and installed on your system.download-using-manifests.pl: perl: warning: Falling back to the standard locale ("C").download-from-binary-cache.pl: perl: warning: Setting locale failed.download-from-binary-cache.pl: perl: warning: Please check that your locale settings:download-from-binary-cache.pl: LANGUAGE = (unset),download-from-binary-cache.pl: LC_ALL = (unset),download-from-binary-cache.pl: LANG = "en_US.UTF-8" [...] fetching path ‘/nix/store/6mk1s81va81dl4jfbhww86cwkl4gyf4j-stdenv’...perl: warning: Setting locale failed.perl: warning: Please check that your locale settings:LANGUAGE = (unset),LC_ALL = (unset),LANG = "en_US.UTF-8"are supported and installed on your system.perl: warning: Falling back to the standard locale ("C"). *** Downloading ‘https://cache.nixos.org/nar/0aznfg1g17a8jdzvnp3pqszs9rq2wiwf2rcgczyg5b3k6d0iricl.nar.xz’ to ‘/nix/store/6mk1s81va81dl4jfbhww86cwkl4gyf4j-stdenv’...% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed100 8324 100 8324 0 0 6353 0 0:00:01 0:00:01 --:--:-- 6373 [nix-shell:~]$
檢查GCC版本:
[nix-shell:~]$ gcc -vUsing built-in specs.COLLECT_GCC=/nix/store/dyj2k6ch45r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/bin/gccCOLLECT_LTO_WRAPPER=/nix/store/dyj2k6ch45r1ips4vr97md2i0yvl4r5c-gcc-5.4.0/libexec/gcc/x86_64-unknown-linux-gnu/5.4.0/lto-wrapperTarget: x86_64-unknown-linux-gnuConfigured with:Thread model: posixgcc version 5.4.0 (GCC)
現(xiàn)在,繼續(xù)并測試代碼。完成后,輸入 exit
返回到控制臺。
[nix-shell:~]$ exitexit
一旦你從 nix-shell 中退出,你就不能使用 GCC。
這是另一個例子。
$ nix-shell -p hello
這會構(gòu)建或下載 GNU Hello 和它的依賴關(guān)系,然后將其放入 hello
命令所在的 Bash shell 中,所有這些都不會影響你的正常環(huán)境:
[nix-shell:~]$ helloHello, world!
輸入 exit
返回到控制臺。
[nix-shell:~]$ exit
現(xiàn)在測試你的 hello
程序是否可用。
$ hellohello: command not found
以上是“怎么在Linux中不安裝軟件測試一個軟件包”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。