美文网首页
import paddle 遇到错误

import paddle 遇到错误

作者: 我的小小笔尖 | 来源:发表于2022-04-26 15:35 被阅读0次

问题描述:

import paddle 遇到错误
ImportError: DLL load failed while importing core_avx: 找不到指定的模块。

参考信息:
https://aistudio.baidu.com/paddle/forum/topic/show/992594

https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads 下载适用于 Visual Studio 2015、2017 和 2019 的 Microsoft Visual C++ 可再发行软件包 下载安装 vc_redist.x86.exe 和 vc_redist.x64.exe 后就可以了。

具体方法:
我的是64位系统,下载安装了vc_redist.x64.exe,安装后重启系统

再次 import paddle 报其他错误

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\yaoinstall\pythonenv\paddle\lib\site-packages\paddle_init.py", line 59, in <module>
import paddle.dataset # noqa: F401
File "C:\yaoinstall\pythonenv\paddle\lib\site-packages\paddle\dataset_init
.py", line 27, in <module>
import paddle.dataset.flowers # noqa: F401
File "C:\yaoinstall\pythonenv\paddle\lib\site-packages\paddle\dataset\flowers.py", line 39, in <module>
from paddle.dataset.image import load_image_bytes
File "C:\yaoinstall\pythonenv\paddle\lib\site-packages\paddle\dataset\image.py", line 48, in <module>
import_cv2_proc = subprocess.Popen(
File "C:\yaoinstall\Python\Python39\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\yaoinstall\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

处理方法:
打开 C:\yaoinstall\Python\Python39\lib\subprocess.py 文件,将 shell=False 改为 shell=True

shell.PNG

再次 import paddle 报其他错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\yaoinstall\pythonenv\paddle\lib\site-packages\paddle_init_.py", line 27, in <module>
monkey_patch_variable()
File "C:\yaoinstall\pythonenv\paddle\lib\site-packages\paddle\fluid\layers\math_op_patch.py", line 421, in monkey_patch_variable
for method_name in paddle.tensor.tensor_method_func:
AttributeError: partially initialized module 'paddle' has no attribute 'tensor' (most likely due to a circular import)

关闭命令窗口,重新进入虚拟环境
再次 import paddle 报几个警告信息,忽略。
输入命令,提示安装成功:PaddlePaddle is installed successfully!

paddle.utils.run_check()
success.PNG

相关文章

网友评论

      本文标题:import paddle 遇到错误

      本文链接:https://www.haomeiwen.com/subject/vzgcyrtx.html