解决ModuleNotFoundError: No module named ‘paddle‘

When installing Baidu's PaddlePaddle, I encountered the ModuleNotFoundError: No module named 'paddle' error and recorded the resolution process.

After installing PaddlePaddle, run the following statement in the Python interpreter

import paddle

提示ModuleNotFoundError: No module named ‘paddle’

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'paddle'

re-install

The Internet says that reinstalling PaddlePaddle will do the trick.

CPU version

python -m pip install paddlepaddle==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

GPU version

python -m pip install paddlepaddle-gpu==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

Uninstall the old version first and then reinstall it

But after reinstalling it myself, the original prompt still appears.
Later I found that uninstalling and then reinstalling worked fine.
Uninstalling the CPU version of PaddlePaddle:

python -m pip uninstall paddlepaddle

Uninstall the GPU version of PaddlePaddle:

python -m pip uninstall paddlepaddle-gpu

After uninstalling, the following prompt will appear when uninstalling again, proving that it has been completely uninstalled.

(base) PS E:\PaddlePaddle> python -m pip uninstall paddlepaddle-gpu
WARNING: Skipping paddlepaddle-gpu as it is not installed.
(base) PS E:\PaddlePaddle> python -m pip uninstall paddlepaddle
WARNING: Skipping paddlepaddle as it is not installed.

For me, just reinstall PaddlePaddle. What about yours?

Guess you like

Origin blog.csdn.net/TyroneKing/article/details/129925979