python安装配置Theano ImportError:cannot import name 'configparser'
来源:互联网 发布:java哪些源码值得看 编辑:程序博客网 时间:2024/06/18 04:52
在安装配置python,安装mingw,安装theano时进行测试。在测试前,即所有环境配置完成后要重启电脑一次。测试时报出如下异常:ImportError:cannot import name 'configparser'
测试方式一:
将如下测试代码复制放到python中运行一下:
import numpy as npimport timeimport theanoA = np.random.rand(1000,10000).astype(theano.config.floatX)B = np.random.rand(10000,1000).astype(theano.config.floatX)np_start = time.time()AB = A.dot(B)np_end = time.time()X,Y = theano.tensor.matrices('XY')mf = theano.function([X,Y],X.dot(Y))t_start = time.time()tAB = mf(A,B)t_end = time.time()print "NP time: %f[s], theano time: %f[s] (times should be close when run on CPU!)"%(np_end-np_start, t_end-t_start)print "Result difference: %f"%(np.abs(AB-tAB).max(), )
测试方式二:
Import theanoprint theano.config.blas.ldflags
通过上述两种方式进行测试,均未通过,报出如下异常:ImportError:cannot import name 'configparser'
解决方法:我修改了两个地方,然后重启电脑后,该异常信息消失。
修改处一:由于网上的教程,当时添加了一个环境变量,变量名称为:“PYTHONPATH”,变量值为“C:\Anaconda\Lib\site-packages\theano;”
的修改是将该环境变量删除,不用添加。
修改处二:修改.theanorc.txt文件。修改及部分说明如下图所示,为了方便复制,代码在最后面。
代码如下:
[global]openmp=Falsedevice = gpuoptimizer_including=cudnnfloatX = float32allow_input_downcast=True[lib]cnmem = 0.8[blas]ldflags=[gcc]cxxflags=-IC:\Users\f\Anaconda3\MinGW[nvcc]flags = -LC:\Users\f\Anaconda3\libscompiler_bindir = G:\VS\VC\binfastmath = True修改上述两处后,重启电脑,报出的异常信息就没有了。
0 0
- python安装配置Theano ImportError:cannot import name 'configparser'
- Python ImportError: cannot import name *
- Python~ImportError:cannot import name BeautifulSoup
- python 错误: ImportError: cannot import name xxx
- python错误:ImportError: cannot import name Thing2Literal
- Python: ImportError: cannot import name __check_buil
- Python: ImportError: cannot import name 'BeautifulSoup'
- Python ImportError: cannot import name 'MongoClient'
- Python ImportError: cannot import name NUMPY_MKL
- python之import异常-ImportError: cannot import name xxx
- ImportError: cannot import name Pseudo
- ImportError: cannot import name IncompleteRead
- ImportError: cannot import name HTTPSHandler
- importError: cannot import name 'izip_longest'
- ImportError: cannot import name mkdtemp
- ImportError: cannot import name HTTPSHandler
- ImportError:cannot import name game
- ImportError: cannot import name Process
- 分区分配方案
- iOS 删除线不显示问题 10.3以后
- 能上QQ却上不了网页
- Spring---AOP基本概念以及Advice5种类型的通知注解应用实例
- leetcode 461. Hamming Distance
- python安装配置Theano ImportError:cannot import name 'configparser'
- 互换两个变量,不使用中间变量
- POJ 3067
- JS原型设计模式(二)
- pdf 转 word
- mysql索引知识
- Android http Post 传文件
- 【linux】Makefile 基本知识
- 获取本机系统时间