Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
导入tensorflow时出错:name错误:name';python';没有定义_Python_Tensorflow_Python Import - Fatal编程技术网

导入tensorflow时出错:name错误:name';python';没有定义

导入tensorflow时出错:name错误:name';python';没有定义,python,tensorflow,python-import,Python,Tensorflow,Python Import,我正在尝试使用Spyder导入Tensorflow,之前我也尝试导入Keras和Theano,但出现了一个错误:模块“Theano”没有属性“compile”,Tensorflow的导入正常 为了解决这个问题,我安装了 conda install tensor 至此,我解决了Keras和Theano的问题,但现在Tensorflow无法导入,显示了以下错误: import tensorflow Traceback (most recent call last): File "<ip

我正在尝试使用Spyder导入Tensorflow,之前我也尝试导入Keras和Theano,但出现了一个错误:
模块“Theano”没有属性“compile”
,Tensorflow的导入正常

为了解决这个问题,我安装了

conda install tensor
至此,我解决了Keras和Theano的问题,但现在Tensorflow无法导入,显示了以下错误:

import tensorflow
Traceback (most recent call last):

  File "<ipython-input-9-d6579f534729>", line 1, in <module>
    import tensorflow

  File "C:\Users\rodmo\Anaconda3\envs\py35\lib\site-
  packages\tensorflow\__init__.py", line 50, in <module>
    del python

NameError: name 'python' is not defined
导入tensorflow
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
输入张量流
文件“C:\Users\rodmo\Anaconda3\envs\py35\lib\site-
packages\tensorflow\\uuuuuu init\uuuuuuuuuuuuuuuuuuuuuuu.py”,第50行,在
德尔python
NameError:未定义名称“python”

我愿意打赌“模块'theano'没有属性'compile'”将通过使用不同版本的theano模块来解决。通常,当我遇到这样的错误时,这是因为导入它的代码取决于随后更改的特定版本

对于conda之类的东西,conda不会安装到基本python目录,因此如果pythonpath指向其他地方,可能会带来麻烦。你能发布你运行的theano的版本吗

In [1]: import theano
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

In [2]: theano.compile?
Type:        module
String form: <module 'theano.compile' from '/home/micheal.taylor/.virtualenvs/tensorflow_test/lib/python2.7/site-packages/theano/compile/__init__.pyc'>
File:        ~/.virtualenvs/tensorflow_test/lib/python2.7/site-packages/theano/compile/__init__.py
Docstring:   <no docstring>

In [3]: theano.__version__
Out[3]: u'1.0.1'
[1]中的
:导入编号
警告(theano.tensor.blas):对blas函数使用基于NumPy C-API的实现。
在[2]:theano.compile?
类型:模块
字符串形式:
文件:~/.virtualenvs/tensorflow\u test/lib/python2.7/site packages/theano/compile/\u init\u.py
文档字符串:
在[3]中:无版本__
Out[3]:u'1.0.1'
问题已解决

在系统属性中设置参数---->Advanced---->Environment Variables---->system Variables---->New

变量-MKL_线程层

价值-GNU


对我来说,它通过打开anaconda提示符来工作。在此之前,我将json文件更改为“KERAS_BACKEND=tensorflow”

Hi,是相同的-“1.0.1”。提前谢谢。