1. 程式人生 > >Windows安裝fastTest和skift 出現 ModuleNotFoundError: No module named 'fastText'

Windows安裝fastTest和skift 出現 ModuleNotFoundError: No module named 'fastText'

安裝skift後,在訓練模型時出現:No module named 'fastText'

skift:scickit-learn Python fastText的包裝器。

注意:安裝skift本身不會安裝fasttext,因為PyPI目前尚未保留官方Python繫結

要安裝的版本fasttext,因此安裝skift之前需要安裝一下依賴包:

安裝 fastText 時出現: 

ModuleNotFoundError: No module named 'Cython'

需要安裝Cython(a language for writing Python C extensions)

pip install Cython

成功安裝Cython後,安裝fastText 時出現錯誤:

 Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

這是因為 fastText 模組編譯需要依賴Visual C++ 14.0的編譯工具,解決方法:

1.下載build-tools,http://landinghub.visualstudio.com/visual-cpp-build-tools(

好像微軟不再提供);

2.去微軟的網站下載 visual studio,結果顯示需要4GB以上的安裝空間,因為是線上安裝,又加上微軟這種主要伺服器在國外的軟體安裝,想必耗時長久。所以去查詢另外的解決方法;

 3.直接去找已經編譯好的安裝包,fasttext-0.8.22-cp36-cp36m-win_amd64.whl ,去該網站下載與您電腦Python版本對應的*.whl檔案。然後切換到檔案下載目錄,並使用pip安裝本地包:

安裝成功: