Tensflow 安装方法以及报错解决方案
1、查看python版本创建环境
python -V
本人结果如下:
Python 3.9.7
2、创建环境
创建虚拟环境tensorflow,并激活
conda create -n tensorflow python=3.9
conda activate tensorflow
3、查看GPU版本
nvidia-smi
结果
CUDA Version: 12.6
查看型号
nvidia-smi -L
结果
GPU 0: NVIDIA GeForce RTX ……
安装CUDA相关库
conda install cudatoolkit=11.8 cudnn=8.9
安装软件包
pip install tensorflow==2.10
报错解决方案
爆错:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with ‘pybind11>=2.12’.
……
TypeError: Unable to convert function return value to a Python type! The signature was
() -> handle
>>> ^Z
指定安装包
pip install numpy==1.26