导入张量流时出现错误'文件'<frozen importlib._bootstrap =“”>“,_find_and_load中的第968行'

时间:2019-03-01 23:51:19

标签: python numpy tensorflow

我的系统上安装了Acanonda。我通过给

安装了tensorflow
 pip install tensorflow 

已成功安装:

以下是最后的痕迹:

Successfully installed absl-py-0.7.0 astor-0.7.1 gast-0.2.2 grpcio-1.19.0 
keras-applications-1.0.7 keras-preprocessing-1.0.9 markdown-3.0.1 mock-2.0.0 
pbr-5.1.3 protobuf-3.7.0 tensorboard-1.13.0 tensorflow-1.13.1 tensorflow- 
estimator-1.13.0 termcolor-1.1.0

现在,我尝试运行以下脚本。没什么,只是导入库。

import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt

在运行脚本时,出现以下错误:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
SystemError: <class '_frozen_importlib._ModuleLockManager'> returned a 
result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-03-02 04:48:32.404215: F tensorflow/python/lib/core/bfloat16.cc:675] 
Check failed: PyBfloat16_Type.tp_base != nullptr

似乎与Numpy有关。这是我的Numpy版本:'

import numpy
numpy.version.version
1.14.0'

我对python有一些了解,但对tensorflow来说是全新的。我在这里做什么错了?

1 个答案:

答案 0 :(得分:3)

尝试在新的虚拟环境中安装numpy Sub find() Dim dict As Object, names, nums, r As Long Dim sht As Worksheet Set sht = ActiveSheet Set dict = CreateObject("scripting.dictionary") names = Range("C2:C99999").Value nums = Range("C2:C99999").Offset(0, 4).Value For r = 1 To UBound(names) dict(names(r, 1)) = dict(names(r, 1)) + nums(r, 1) Next r WriteCounts dict, sht.Range("J1") End Sub Sub WriteCounts(dict As Object, rngStart As Range) Dim k For Each k In dict.keys rngStart.Value = k rngStart.Offset(0, 1).Value = dict(k) Set rngStart = rngStart.Offset(1, 0) Next k End Sub

v1.16

这应该可以解决问题。