【學習筆記】Python AI相關套件安裝

前言
某天作者本人忽然很想接觸AI的領域,於是乎我心血來潮地把相關的Python套件安裝到電腦中的奮鬥史。

開發環境
Python3.7

相關的套件
tensorflow
keras
numpy

長話短說,以下是我遇過印象比較深的幾個Error
type object 'object' has no attribute 'dtype'
module 'tensorflow.compat.v2.__internal__.tracking' has no attribute 'TrackableSaver'
AttributeError: module 'tensorflow.compat.v2.__internal__.tracking' has no attribute 'TrackableSaver'
NameError: name 'model' is not defined
from markupsafe import Markup, escape, soft_unicode ImportError: cannot import name 'soft_unicode' from 'markupsafe'
from tensorflow.python.framework import fast_tensor_util numpy.ndarray size changed, may indicate binary incompatibility.

基本上,上述Error大多數會發生的原因,大概率與tensorflow、keras、numpy,這三個的版本衝突有關。
後來經過不斷的反覆測試,我找到目前能在我這的開發環境運行的版本是2.10.0
所以只要執行下述四個指令,大概率可以把上述問題給解決掉。

pip install keras==2.10.0
pip install tensorflow==2.10.0
pip install git+https://github.com/raghakot/keras-vis.git -U
python -m pip install markupsafe==2.0.1

沒有留言:

張貼留言