Paddle安装详解(CPU版本)

1. 安装Python

Python版本

C:\Users\james>python --version
Python 3.12.6

2. 安装paddle

安装paddle及依赖库setuptools

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

python -m pip install setuptools

3. 验证

3.1 初步验证

>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
I0909 21:46:15.428799 13660 program_interpreter.cc:212] New Executor is Running.
I0909 21:46:15.520946 13660 interpreter_util.cc:624] Standalone Executor is Used.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python\Python312\Lib\site-packages\paddle\utils\install_check.py", line 273, in run_check
    _run_static_single(use_cuda, use_xpu, use_custom, custom_device_name)
  File "C:\Python\Python312\Lib\site-packages\paddle\utils\install_check.py", line 151, in _run_static_single
    exe.run(
  File "C:\Python\Python312\Lib\site-packages\paddle\base\executor.py", line 1746, in run
    res = self._run_impl(
          ^^^^^^^^^^^^^^^
  File "C:\Python\Python312\Lib\site-packages\paddle\base\executor.py", line 1952, in _run_impl
    ret = new_exe.run(
          ^^^^^^^^^^^^
  File "C:\Python\Python312\Lib\site-packages\paddle\base\executor.py", line 835, in run
    tensors = as_numpy(tensors, copy=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Python312\Lib\site-packages\paddle\base\executor.py", line 156, in as_numpy
    return [as_numpy(t, copy) for t in tensor]
            ^^^^^^^^^^^^^^^^^
  File "C:\Python\Python312\Lib\site-packages\paddle\base\executor.py", line 168, in as_numpy
    return np.array(tensor)
           ^^^^^^^^^^^^^^^^
TypeError: __array__(): incompatible function arguments. The following argument types are supported:
    1. (self: paddle.base.libpaddle.Tensor) -> numpy.ndarray

Invoked with: <paddle.base.libpaddle.Tensor object at 0x0000019244D2CF70>; kwargs: copy=True

paddle2.6.1与numpy2.1.1兼容性有问题。

3.2 将numpy版本从2.1.1降为2.0.1

# Successfully uninstalled numpy-2.1.1
python -m pip uninstall numpy

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

3.3 再次验证

>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
I0909 22:08:51.428110 26256 program_interpreter.cc:212] New Executor is Running.
I0909 22:08:51.458137 26256 interpreter_util.cc:624] Standalone Executor is Used.
PaddlePaddle works well on 1 CPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

验证成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

flysnow010

你的鼓励就是我最大的创作动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值