记一次历经波折的环境配置过程。
1. 在服务器新环境安装python=3.6和tensor-gpu=2.0.0
ipython可能有毒,在命令行import tensorflow都没报错。。
在pycharm配置好服务器同步后,运行出现大面积报错
RecursionError: maximum recursion depth exceeded
Traceback (most recent call last):
File "/home/shiyao/LSY/test.py", line 1, in <module>
import tensorflow as tf
File "/home/shiyao/anaconda3/envs/lsy_tensor2/lib/python3.6/site-packages/tensorflow/__init__.py", line 98, in <module>
from tensorflow_core import *
File "/home/shiyao/anaconda3/envs/lsy_tensor2/lib/python3.6/site-packages/tensorflow_core/__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 942, in _find_and_load_unlocked
···········
RecursionError: maximum recursion depth exceeded
Process finished with exit code 1
上网搜索解决办法,都集中在解决循环超过深度的问题,看了下发现从import就开始报错了,感觉不是循环问题。最后反应过来时原来装的CUDA版本和tensorflow不匹配。
2. 安装对应的tensorflow版本
出现问题!!
-
无法直接pip install tensorflow==2.9.1
-
先更新python
conda install python==3.9
-
然后就可以安装tensor了
pip install tensorflow-gpu==2.9.0
然而,并没有结束,进入ipython之后,仍然ModuleNotFoundError: No module named 'tensorflow’💔
3. 怀疑版本仍旧不匹配
尝试了很多次,最后
python 3.10.9
tensorflow-gpu 2.10.1
终于!!!!!!!!!
可以快乐跑代码了✌