Windows10上編譯MXNet原始碼操作步驟(Python)
1. 按照https://blog.csdn.net/fengbingchun/article/details/84997490 中操作步驟首先在Windows上通過VS2017編譯MXNet原始碼;
2. 從 https://mxnet.incubator.apache.org/install/windows_setup.html#install-the-mxnet-package-for-python 下載mingw64_dll.zip;
3. 解壓縮mingw64_all.zip,並將其內的libgcc_s_seh-1.dll,libgfortran-dll,libquadmath-0.dll三個動態庫拷貝到E:\GitCode\MXNet_Test\lib\rel\x64目錄下,此目錄下已包含由MXNet_Test.sln工程編譯生成的libopenblas.dll和libmxnet.dll動態庫;
4. 將E:\GitCode\MXNet_Test\lib\rel\x64目錄新增到系統環境變數,重啟;
5. Windows中Python3.x, NumPy, Matplotlib的安裝可參考:https://blog.csdn.net/fengbingchun/article/details/77887050 ;
6. Windows中OpenCV3.4.2+Python3.2的安裝可參考:https://blog.csdn.net/fengbingchun/article/details/84030309 ;
7. 將E:\GitCode\MXNet_Test\lib\rel\x64目錄下的libmxnet.dll動態庫拷貝到E:\GitCode\MXNet_Test\src\mxnet\python\mxnet目錄下;
8. 開啟命令提示符,並將其定位到E:\GitCode\MXNet_Test\src\mxnet\python目錄下,執行:
python setup.py install
執行結果如下:
9. 驗證MXNet python是否安裝正確,測試程式碼如下:
import mxnet as mx import numpy as np import cv2 img = cv2.imread("E:\GitCode\MXNet_Test\data\images\handwritten_digits\0.png") a = mx.nd.ones((2, 3)); print((a*2).asnumpy()) b = np.array([1, 2, 3]); print(b) print("ok")
執行結果如下: