python错误:无法从“cupy.core”导入名称“core”

2024-05-16 19:00:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我对Python编程相当陌生,我试着运行一些DCGAN训练脚本 https://github.com/ml5js/training-dcgan

在使用conda创建环境并构建所有依赖项之后,我仍然拥有 运行py程序时出现问题:

RuntimeError: CUDA environment is not correctly set up
(see https://github.com/chainer/chainer#installation).CuPy is not correctly installed.

If you are using wheel distribution (cupy-cudaXX), make sure that the version of CuPy you installed matches with the version of CUDA on your host.
Also, confirm that only one CuPy package is installed:
  $ pip freeze

If you are building CuPy from source, please check your environment, uninstall CuPy and reinstall it with:
  $ pip install cupy --no-cache-dir -vvvv

Check the Installation Guide for details:
  https://docs-cupy.chainer.org/en/latest/install.html

original error: cannot import name 'core' from 'cupy.core' (C:\Users\keyvane\anaconda3\lib\site-packages\cupy\core\__init__.py)
> c:\users\keyvane\anaconda3\lib\site-packages\chainer\backends\cuda.py(93)check_cuda_available()
-> raise RuntimeError(msg)

我多次尝试正确地重新安装整个环境,但仍然有相同的错误。也许有人有办法解决这个问题?任何帮助都将是了不起的:) 这是我的配置:

Windows 10  / Python 3.6 (64bits)
absl-py==0.7.1
astor==0.8.1
astunparse==1.6.3
blinker==1.4
cachetools==4.1.0
certifi==2020.4.5.1
cffi==1.14.0
chainer==6.2.0
chardet==3.0.4
click==7.1.2
cryptography==2.9.2
cupy==6.0.0
cupy-cuda100==6.2.0
fastrlock==0.5
filelock==3.0.12
gast==0.2.2
google-auth==1.16.1
google-auth-oauthlib==0.4.1
google-pasta==0.2.0
grpcio==1.29.0
h5py==2.10.0
idna==2.9
importlib-metadata==1.6.1
Keras==2.2.4
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
Markdown==3.2.2
mkl-fft==1.0.15
mkl-random==1.1.1
mkl-service==2.3.0
numpy==1.18.1
oauthlib==3.1.0
olefile==0.46
opt-einsum==3.2.1
Pillow==7.1.2
protobuf==3.12.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyJWT==1.7.1
pyOpenSSL==19.1.0
pyreadline==2.1
PySocks==1.7.1
PyYAML==5.3.1
requests==2.23.0
requests-oauthlib==1.3.0
rsa==4.0
scipy==1.4.1
six==1.14.0
tensorboard==2.2.1
tensorboard-plugin-wit==1.6.0.post3
tensorflow==2.1.0
tensorflow-cpu==2.2.0
tensorflow-estimator==2.1.0
tensorflow-gpu==2.0.0
tensorflow-hub==0.5.0
tensorflowjs==1.2.6
termcolor==1.1.0
typing==3.6.6
typing-extensions==3.6.6
urllib3==1.25.9
Werkzeug==1.0.1
win-inet-pton==1.1.0
wincertstore==0.2
wrapt==1.12.1
zipp==3.1.0

多谢各位


Tags: installedthepyhttpscoreyouistensorflow
1条回答
网友
1楼 · 发布于 2024-05-16 19:00:57

您是否安装了多个版本的CUDA(应该可以通过在windows搜索栏中键入“卸载”并查看来判断)。看起来您安装了几个不同版本的tensorflow,所以我假设您可能也安装了几个版本的CUDA。如果是这样的话,我将在黑暗中猜测,并说当您运行代码时,无论出于何种原因,它都试图使用与您想要的不同版本的CUDA。因此,如果我的猜测是正确的,只要尝试卸载错误版本的CUDA,假设您不需要它们

如果您确实需要多个版本的CUDA,那么可能有某种方法可以在您使用的代码中调用tensorflow的特定版本(可能是CUDA)

如果我猜错了,我也不知道

相关问题 更多 >