今天在ubuntu下运行一个用python和Torch编写的程序,报红色的错误如题,
/home/viriya/torch/install/share/lua/5.1/trepl/init.lua:389: module 'libjpeg' not found:No LuaRocks module found for libjpeg
no field package.preload['libjpeg']
no file '/home/viriya/.luarocks/share/lua/5.1/libjpeg.lua'
no file '/home/viriya/.luarocks/share/lua/5.1/libjpeg/init.lua'
no file '/home/viriya/torch/install/share/lua/5.1/libjpeg.lua'
no file '/home/viriya/torch/install/share/lua/5.1/libjpeg/init.lua'
no file './libjpeg.lua'
no file '/home/viriya/torch/install/share/luajit-2.1.0-beta1/libjpeg.lua'
no file '/usr/local/share/lua/5.1/libjpeg.lua'
no file '/usr/local/share/lua/5.1/libjpeg/init.lua'
no file '/home/viriya/.luarocks/lib/lua/5.1/libjpeg.so'
no file '/home/viriya/torch/install/lib/lua/5.1/libjpeg.so'
no file '/home/viriya/torch/install/lib/libjpeg.so'
no file './libjpeg.so'
no file '/usr/local/lib/lua/5.1/libjpeg.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
warning: <libjpeg> could not be loaded (is it installed?)
/home/viriya/torch/install/share/lua/5.1/dok/inline.lua:738: <image.loadJPG> libjpeg package not found, please install libjpeg
stack traceback:
[C]: in function 'error'
/home/viriya/torch/install/share/lua/5.1/dok/inline.lua:738: in function 'error'
/home/viriya/torch/install/share/lua/5.1/image/init.lua:232: in function 'loader'
/home/viriya/torch/install/share/lua/5.1/image/init.lua:388: in function 'load'
run_model.lua:67: in function 'run_image'
run_model.lua:164: in main chunk
[C]: in function 'dofile'
...riya/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x7f2220809570
用sudo apt-get install libjpeg和pip install libjpeg、sudo apt-get install libjpeg-dev都不行,还重新下载编译libjpeg.git也不行,然后在网上查到这样重新安装image:sudo ~/torch/install/bin/luarocks install image,终于解决了。
之前在cmd运行过luarocks install image,为什么要这样运行才解决了呢?sudo ~/torch/install/bin/luarocks install image
我想应该是不加sudo和加sudo运行安装后不一样吧。