兩種方法
法一: 網上最多推薦的 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 包管理器將會打印所有命令的輸出,當他們被執行的時候(不知道能幹什麼用)