我正在尝试使用Python和Tensorflow 2,但是部分代码无法编译:
然后,当我运行应用程序时,出现关于import语句的奇怪错误:
"D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\Scripts\python.exe" "D:/Progetti/Phython/TensorFlow 2 quickstart for beginners/Test.py"
Traceback (most recent call last):
File "D:/Progetti/Phython/TensorFlow 2 quickstart for beginners/Test.py", line 5, in <module>
import tensorflow as tf
File "D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
from tensorflow_core import *
File "D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\Mario\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\lib\site-packages\tensorflow_core\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "D:\Progetti\Phython\TensorFlow 2 quickstart for beginners\venv\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: Impossibile trovare la procedura specificata.
Process finished with exit code 1
问题的根源是什么?