gpt4 book ai didi

python-2.7 - Theano导入错误: cannot import name inplace_increment

转载 作者:行者123 更新时间:2023-12-01 10:30:21 24 4
gpt4 key购买 nike

我已经安装了 Theano:

(python2) bash-3.2$ sudo pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

我在 Python 2.7 中使用 conda。括号里的python2是我的conda环境。我正在尝试从 iGAN 运行代码:https://github.com/junyanz/iGAN .我在 OS X 10.11.6 上。

我收到的错误是 ImportError: cannot import name inplace_increment。我已经尝试手动删除 Theano 缓存(如 https://github.com/Theano/Theano/issues/5564 中所述),但仍然出现相同的错误。 (我不能使用 theano-cache purge 因为它需要安装与 OpenCV 所需版本冲突的 scipy 版本。)我还尝试通过 pip 卸载并重新安装 Theano,但仍然得到同样的错误。有什么建议吗?

这里是上下文:

(python2) bash-3.2$ python iGAN_main.py 
//anaconda/envs/python2/lib/python2.7/site-packages/numpy/lib/utils.py:254: FutureWarning: Numpy has detected that you (may be) writing to an array returned
by numpy.diagonal or by selecting multiple fields in a record
array. This code will likely break in the next numpy release --
see numpy.diagonal or arrays.indexing reference docs for details.
The quick fix is to make an explicit copy (e.g., do
arr.diagonal().copy() or arr[['f0','f1']].copy()).
ai = a.__array_interface__
Traceback (most recent call last):
File "iGAN_main.py", line 9, in <module>
import constrained_opt
File "/Users/.../Desktop/Code/iGAN/constrained_opt.py", line 3, in <module>
from lib.rng import np_rng
File "/Users/.../Desktop/Code/iGAN/lib/rng.py", line 2, in <module>
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/__init__.py", line 102, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/scan_module/__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/scan_module/scan_opt.py", line 60, in <module>
from theano import tensor, scalar
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/tensor/__init__.py", line 9, in <module>
from theano.tensor.subtensor import *
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/tensor/subtensor.py", line 27, in <module>
from cutils_ext.cutils_ext import inplace_increment
ImportError: cannot import name inplace_increment

最佳答案

我遇到了同样的问题。

手动删除缓存有效。

rm -rf ~/.theano

如果这没有帮助,请尝试从源安装。

python setup.py install

关于python-2.7 - Theano导入错误: cannot import name inplace_increment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43312593/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com