兩種方法
法一: 網上最多推薦的
pkg install -forge 包名
,但沒有成功 ,可能是公司無線網太不穩定
法二: http://octave.sourceforge.net/packages.php 找到需要的包并下載下傳檔案,cd切換到檔案儲存路徑,
pkg install 檔案名
即可,注意不要解壓
pkg install 的可選參數
使用help pkg 檢視pkg 的幫助資訊,截取install的部分 ,看下法一和法二的不同:
'install'
Install named packages. For example,
pkg install image-1.0.0.tar.gz
installs the package found in the file 'image-1.0.0.tar.gz'.
The file containing the package can be an url, e.g.
pkg install 'http://somewebsite.org/image-1.0.0.tar.gz'
installs the package found in the given url. This requires an
internet connection and the cURL library.
_Security risk_: no verification of the package is performed
before the installation. It has the same security issues as
manually downloading the package from the given url and
installing it.
_No support_: the GNU Octave community is not responsible for
packages installed from foreign sites. For support or for
reporting bugs you need to contact the maintainers of the
installed package directly (see the 'DESCRIPTION' file of the
package)
使用
pkg install image-1.0.0.tar.gz
來通過檔案安裝包。(即法二,是以明明這個方法在幫助文檔的最前面為什麼這麼多人推薦用-forge?)
也可以寫為一個url的形式,但需要網絡連接配接。
存在的安全風險:在安裝之間沒有對包進行校驗。其與手動從這個url下載下傳包并安裝,具有相同的安全問題。
不支援:GNU Octave 社群不對外部的網站下載下傳的包負責,如果需要支援或需要送出bug,你須要直接聯系這個包的維護者。
可選參數:
The OPTION variable can contain options that affect the manner
in which a package is installed. These options can be one or
more of
'-nodeps'
The package manager will disable dependency checking.
With this option it is possible to install a package even
when it depends on another package which is not installed
on the system. *Use this option with care.*
-nodeps 禁用依賴檢查,即不檢查包的依賴關系,即使目前安裝的包的依賴包沒有在系統中安裝,這個包也會被安裝。小心的使用這個option
'-local'
A local installation (package available only to current
user) is forced, even if the user has system privileges.
-local 本地安裝,僅為目前使用者安裝包,即使user 是管理者權限
'-global'
A global installation (package available to all users) is
forced, even if the user doesn't normally have system
privileges.
-global 全局(?)安裝,為所有使用者安裝這個package,即使目前使用者沒有系統權限
'-forge'
Install a package directly from the Octave Forge
repository. This requires an internet connection and the
cURL library.
_Security risk_: no verification of the package is
performed before the installation. There are no
signature for packages, or checksums to confirm the
correct file was downloaded. It has the same security
issues as manually downloading the package from the
Octave Forge repository and installing it.
-forge 直接從Octave 倉庫中安裝一個包,需要網絡連接配接和cURL libarary
存在的安全風險:安裝前沒有進行校驗。包沒有簽名和校驗值來确認檔案是否被正确下載下傳。其與手動從Octave Forge 倉庫 下載下傳包并安裝具有相同的安全問題。
'-verbose'
The package manager will print the output of all commands
as they are performed.
-verbose 包管理器将會列印所有指令的輸出,當他們被執行的時候(不知道能幹什麼用)