问题
I tried several commands to install the package optim into my Octave in Ubuntu 16.10 to use the function xcorr, but I miserably failed.
Some of these commands were:
- sudo apt-get install octave-optim
- sudo apt-get install liboctave-dev
- sudo apt-get install octave-signal
- sudo apt-get install octave-pkg-dev
Can somebody explain me or does somebody know how to install the packages in Ubuntu 16?
After running the above-mentioned commands, I restarted Octave but the command xcorr() was still returning the error:
warning: the 'xcorr' function belongs to the signal package from Octave Forge which you have installed but not loaded. To load the package, run 'pkg load signal' from the Octave prompt.
Unfortunately, 'pkg' returns:
No command 'pkg' found, did you mean: Command 'pig' from package 'bsdgames' (universe) Command 'peg' from package 'peg' (universe) Command 'pki' from package 'pki-tools' (universe) Command 'pki' from package 'strongswan-starter' (main) Command 'dpkg' from package 'dpkg' (main) Command 'pg' from package 'util-linux' (main) Command 'ekg' from package 'ekg' (universe) Command 'ekg' from package 'ekg-gtk' (universe) pkg: command not found
回答1:
Please type pkg load signal in the Octave command prompt, as you have already have it installed. To auto-load it everytime you start Octave, create ~/.octaverc file and add the line pkg load signal inside the file.
If in future, the pkg that you need is not currently installed, you will need to install it with pkg install -forge <pkgname> e.g. pkg install -forge io. Similarly, you will need to load it as described earlier.
Hope it helps.
来源:https://stackoverflow.com/questions/40490798/install-octave-packages-on-ubuntu-16