我想在我的Jupyter笔记本上使用来自https://github.com/Netflix/vmaf/tree/master/libsvm/python的svmutil函数,它运行在Google Colaboratory上。
正在运行
import svmutil出现以下错误:
ModuleNotFoundError: No module named 'svmutil'如何在colab中安装此github存储库?
发布于 2018-12-27 02:17:44
您需要首先安装库。下面是一个完整的示例:
https://colab.research.google.com/drive/1svYMGnV7HdeqXpN15T5ajxbLijLmBeSm
密钥位:
# Clone the git repo.
!git clone https://github.com/Netflix/vmaf.git
# Build the library.
%cd vmaf/
!make && make install
# Build Python-specific bits.
%cd /content/vmaf/libsvm/python/
!make
# Add the Python module to the path.
import sys
sys.path.append('/content/vmaf/libsvm/python')
# Switch back to the base directory. (This is a convenience
# and isn't required.)
%cd /content发布于 2018-12-26 19:55:10
首先,下载svmutil.py文件并将其保存在运行jupyter笔记本的位置。然后使用以下命令导入svmutil函数
from svmutil import *你可以使用它的功能
svm_train() : train an SVM model
svm_predict() : predict testing data
svm_read_problem() : read the data from a LIBSVM-format file.
svm_load_model() : load a LIBSVM model.
svm_save_model() : save model to a file.
evaluations() : evaluate prediction results.发布于 2019-04-14 16:35:12
公认的答案是下载许多其他东西,而不仅仅是libsvm。如果您只想安装libsvm库,则必须执行以下操作:
!git clone https://github.com/cjlin1/libsvm
%cd libsvm/
!make && make install
%cd /content/libsvm/python/
!make
import sys
sys.path.append('/content/libsvm/python')
%cd /contenthttps://stackoverflow.com/questions/53931575
复制相似问题