github地址:https://github.com/ONNX
1.安裝
從源文件進行安裝
sudo apt-get install protobuf-compiler libprotoc-dev cmake
git clone https://github.com/onnx/onnx.git
cd onnx
git submodule update --init --recursive
python setup.py install
這時候有可能會報錯
Traceback (most recent call last):
File "setup.py", line 8, in <module>
import setuptools
ImportError: No module named setuptools
通過安裝setuptools解決該問題
Python 2.x: sudo apt-get install python-setuptools
Python 3.x: sudo apt-get install python3-setuptools
2.驗證
安裝完成後通過python -c "import onnx"驗證安裝成功
3.測試
ONNX使用pytest作爲測試驅動器,爲了運行測試首先安裝pytest:
pip install pytest nbval
運行pytest