Back

M1 Mac安裝TensorFlow開發環境

今天在M1 Max筆電上安裝TensorFlow環境,以下是我的配置。

				
					conda install anaconda-clean
				
			
				
					anaconda-clean

				
			
				
					xcode-select --install
				
			
				
					conda deactivate
				
			

下載tensorflow-apple-metal-conda.yml放入自己的檔案目錄

https://github.com/RCTechStudio/tensorflow-apple-metal-conda.yml

 

創建Python虛擬環境與安裝TensorFlow

				
					conda env create -f tensorflow-apple-metal-conda.yml -n tensorflow
				
			

啟動虛擬環境,在終端機前方會出現(tensorflow)

				
					conda activate tensorflow

				
			

安裝JupyterLab

				
					pip install jupyter-lab
				
			

啟動JupyterLab

				
					jupyter-lab
				
			

啟動後創建Notebook

測試環境

				
					import sys

import tensorflow.keras
import pandas as pd
import sklearn as sk
import tensorflow as tf
import platform

print(f"Python Platform: {platform.platform()}")
print(f"Tensor Flow Version: {tf.__version__}")
print(f"Keras Version: {tensorflow.keras.__version__}")
print()
print(f"Python {sys.version}")
print(f"Pandas {pd.__version__}")
print(f"Scikit-Learn {sk.__version__}")
gpu = len(tf.config.list_physical_devices('GPU'))>0
print("GPU is", "available" if gpu else "NOT AVAILABLE")
				
			

安裝完成

Ricky Chen
Ricky Chen

Leave a Reply

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *