C:\Users\jpala\.conda\envs\tf\python.exe C:\Users\jpala\Documents\ML\train.py
Traceback (most recent call last):
File "C:\Users\jpala\Documents\ML\train.py", line 5, in <module>
import tensorflow as tf
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\__init__.py", line 42, in <module>
from tensorflow.python import data
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\data\__init__.py", line 21, in <module>
from tensorflow.python.data import experimental
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\data\experimental\__init__.py", line 96, in <module>
from tensorflow.python.data.experimental import service
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\data\experimental\service\__init__.py", line 419, in <module>
from tensorflow.python.data.experimental.ops.data_service_ops import distribute
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\data\experimental\ops\data_service_ops.py", line 25, in <module>
from tensorflow.python.data.ops import dataset_ops
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 29, in <module>
from tensorflow.python.data.ops import iterator_ops
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\data\ops\iterator_ops.py", line 34, in <module>
from tensorflow.python.training.saver import BaseSaverBuilder
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\training\saver.py", line 32, in <module>
from tensorflow.python.checkpoint import checkpoint_management
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\checkpoint\__init__.py", line 3, in <module>
from tensorflow.python.checkpoint import checkpoint_view
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\checkpoint\checkpoint_view.py", line 19, in <module>
from tensorflow.python.checkpoint import trackable_view
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\checkpoint\trackable_view.py", line 20, in <module>
from tensorflow.python.trackable import converter
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\trackable\converter.py", line 18, in <module>
from tensorflow.python.eager.polymorphic_function import saved_model_utils
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\eager\polymorphic_function\saved_model_utils.py", line 36, in <module>
from tensorflow.python.trackable import resource
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\trackable\resource.py", line 22, in <module>
from tensorflow.python.eager import def_function
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\eager\def_function.py", line 20, in <module>
from tensorflow.python.eager.polymorphic_function.polymorphic_function import set_dynamic_variable_creation
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\eager\polymorphic_function\polymorphic_function.py", line 76, in <module>
from tensorflow.python.eager.polymorphic_function import function_spec as function_spec_lib
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\eager\polymorphic_function\function_spec.py", line 25, in <module>
from tensorflow.core.function.polymorphism import function_type as function_type_lib
File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\core\function\polymorphism\function_type.py", line 19, in <module>
from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, OrderedDict
ImportError: cannot import name 'OrderedDict' from 'typing' (C:\Users\jpala\.conda\envs\tf\lib\typing.py)
Process finished with exit code 1
我得到这个错误,而试图安装和运行tensorflow的gpu遵循本教程https://www.youtube.com/watch?v=hHWkvEcDBO0我有python 3.7.4我做错了什么,是版本问题吗?
1条答案
按热度按时间jutyujz01#
根据[www.example.com]:类类型化.有序字典(集合.有序字典,可变Map[KT,VT])(强调是我的):Python.docs]: class typing.OrderedDict(collections.OrderedDict, MutableMapping[KT, VT]) (emphasisis mine):
*版本3.7.2中的新增功能. *
示例:
这就是:* Python 3.7.4 * 来自 * Anaconda ,它的 * typing * 模块有 * OrderedDict 。
唯一合乎逻辑的结论(好吧,排除带有混乱的 * typing * 版本的坏环境)是您实际上运行的是Python〈v3.7.2。
修复方法是运行 * Python〉= v3.7.2 *。
有关详细信息,请查看: