安装paddlepaddle2.2.2版本
第一步:下载python 3.9.12
下载地址:https://www.python.org/downloads/windows/
下载并安装,打勾添加安装路径到path中

测试安装版本命令:
确认是 3.6/3.7/3.8/3.9

python --version
where python

检查 pip 的版本,确认是 20.2.2+

python -m ensurepip
python -m pip --version

升级pip版本命令:
22.0.4升级到23.2.1版本

python -m pip install --upgrade pip

修复报错命令:Downgrade the protobuf package to 3.20.x or lower.
with protoc >= 3.19.0.

pip install protobuf==3.19.0
Collecting protobuf==3.19.0
  Downloading protobuf-3.19.0-cp39-cp39-win_amd64.whl (895 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 895.7/895.7 kB 457.1 kB/s eta 0:00:00
Installing collected packages: protobuf
  Attempting uninstall: protobuf
    Found existing installation: protobuf 4.23.4
    Uninstalling protobuf-4.23.4:
      Successfully uninstalled protobuf-4.23.4
Successfully installed protobuf-3.19.0

第二步:安装paddlepaddle版本2.2.2

python -m pip install paddlepaddle==2.2.2 -i https://mirror.baidu.com/pypi/simple

第三步:测试安装是否成功

python -c "import paddle; print(paddle.__version__)"
2.2.2

testInstall.py代码

import paddle
paddle.utils.run_check()

测试结果如下所示:

Running verify PaddlePaddle program ...
PaddlePaddle works well on 1 CPU.
W0725 18:28:55.107820 17512 fuse_all_reduce_op_pass.cc:76] Find all_reduce operators: 2. To make the speed faster, some all_reduce ops are fused during training, after fusion, the number of all_reduce ops is 2.
PaddlePaddle works well on 2 CPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

main.py

#import matplotlib.pyplot as plt
from numpy import *
import math,time

starttime = time.time()
import paddle

print(paddle.__version__)
print("Cost time: {}".format(time.time()-starttime))

print('helloworld')
#def fib(n):

执行结果如下所示:

2.2.2
Cost time: 1.0016231536865234
helloworld
PS E:\project\python> 

—the—end—

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐