前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >import theano 导入失败的解决方法

import theano 导入失败的解决方法

作者头像
周小董
发布2019-03-25 10:57:39
1.7K0
发布2019-03-25 10:57:39
举报
文章被收录于专栏:python前行者

1、>>> import theano

WARNING (theano.configdefaults): g++not available, if using conda: conda install m2w64-toolchain WARNING (theano.configdefaults): g++not detected ! Theano will be unable to execute optimized C- imp

解决方法:

键入命令解决:conda install m2w64-toolchain

2、import theano 失败解决方法:

问题的解决方案就是安装libpython 查看conda list 如果没有libpython 然后输入一句命令:conda install libpython

然后,import theano,成功!

代码语言:javascript
复制
"""
python3.6
"""
import numpy as np
import theano.tensor as T
from theano import function


x = T.dscalar('x')
y = T.dscalar('y')
z = x+y     # define the actual function in here
f = function([x, y], z)  # the inputs are in [], and the output in the "z"
# def f(x,y):
#     return x+y
print(f(2,3))  # 输出2与3的和

# to pretty-print the function
from theano import pp 
print(pp(z))

# how about matrix
x = T.dmatrix('x')
y = T.dmatrix('y')
z = x + y # 矩阵积 z = T.dot(x,y)
f = function([x, y], z)
print(f(np.arange(12).reshape((3,4)), 10*np.ones((3,4))))

参考:https://blog.csdn.net/lucky_kai/article/details/70234026 https://www.cnblogs.com/luyaoblog/p/7224512.html

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018年09月15日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档