在运行模型python脚本时报错如下内容:

Traceback (most recent call last):
  File "tools/onnx_custom.py", line 83, in <module>
    program2onnx(
  File "/opt/rh/rh-python38/root/usr/local/lib64/python3.8/site-packages/paddle2onnx/command.py", line 173, in program2onnx
    from paddle2onnx.legacy.command import program2onnx
  File "/opt/rh/rh-python38/root/usr/local/lib64/python3.8/site-packages/paddle2onnx/legacy/__init__.py", line 18, in <module>
    import paddle
ModuleNotFoundError: No module named 'paddle'

解决办法

python3 -m pip install common --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install dual --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install tight --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install data --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install prox --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
遇到的问题
[root@localhost ~]# python3 -m pip install paddle --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Running pip install with root privileges is generally not a good idea. Try `python3 -m pip install --user` instead.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Collecting paddle
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/cf/e4b6b9a54d2f072e4491e34317bf5f5fea260da8a3072e641832dc9ce770/paddle-1.0.2.tar.gz (579kB)
     |████████████████████████████████| 583kB 1.3MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8_cfvhys/paddle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8_cfvhys/paddle/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-8_cfvhys/paddle/pip-egg-info
         cwd: /tmp/pip-install-8_cfvhys/paddle/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-8_cfvhys/paddle/setup.py", line 3, in <module>
        import paddle
      File "/tmp/pip-install-8_cfvhys/paddle/paddle/__init__.py", line 5, in <module>
        import common, dual, tight, data, prox
    ModuleNotFoundError: No module named 'common'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[root@localhost ~]# python3 -m pip install common --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple

[root@localhost ~]# python3 -m pip install paddle --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Running pip install with root privileges is generally not a good idea. Try `python3 -m pip install --user` instead.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Collecting paddle
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/cf/e4b6b9a54d2f072e4491e34317bf5f5fea260da8a3072e641832dc9ce770/paddle-1.0.2.tar.gz (579kB)
     |████████████████████████████████| 583kB 1.2MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bqmv9yrd/paddle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bqmv9yrd/paddle/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-bqmv9yrd/paddle/pip-egg-info
         cwd: /tmp/pip-install-bqmv9yrd/paddle/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-bqmv9yrd/paddle/setup.py", line 3, in <module>
        import paddle
      File "/tmp/pip-install-bqmv9yrd/paddle/paddle/__init__.py", line 5, in <module>
        import common, dual, tight, data, prox
    ModuleNotFoundError: No module named 'dual'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[root@localhost ~]# python3 -m pip install dual --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple

[root@localhost ~]# python3 -m pip install paddle --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Running pip install with root privileges is generally not a good idea. Try `python3 -m pip install --user` instead.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Collecting paddle
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/cf/e4b6b9a54d2f072e4491e34317bf5f5fea260da8a3072e641832dc9ce770/paddle-1.0.2.tar.gz (579kB)
     |████████████████████████████████| 583kB 963kB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t3xit45q/paddle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t3xit45q/paddle/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-t3xit45q/paddle/pip-egg-info
         cwd: /tmp/pip-install-t3xit45q/paddle/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-t3xit45q/paddle/setup.py", line 3, in <module>
        import paddle
      File "/tmp/pip-install-t3xit45q/paddle/paddle/__init__.py", line 5, in <module>
        import common, dual, tight, data, prox
    ModuleNotFoundError: No module named 'tight'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[root@localhost ~]# python3 -m pip install tight --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple

[root@localhost ~]# python3 -m pip install paddle --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Running pip install with root privileges is generally not a good idea. Try `python3 -m pip install --user` instead.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Collecting paddle
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/cf/e4b6b9a54d2f072e4491e34317bf5f5fea260da8a3072e641832dc9ce770/paddle-1.0.2.tar.gz (579kB)
     |████████████████████████████████| 583kB 1.0MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mddmmw7y/paddle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mddmmw7y/paddle/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-mddmmw7y/paddle/pip-egg-info
         cwd: /tmp/pip-install-mddmmw7y/paddle/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-mddmmw7y/paddle/setup.py", line 3, in <module>
        import paddle
      File "/tmp/pip-install-mddmmw7y/paddle/paddle/__init__.py", line 5, in <module>
        import common, dual, tight, data, prox
    ModuleNotFoundError: No module named 'data'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[root@localhost ~]# python3 -m pip install data --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple

[root@localhost ~]# python3 -m pip install paddle --trusted-host  pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Running pip install with root privileges is generally not a good idea. Try `python3 -m pip install --user` instead.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://pypi.ngc.nvidia.com
Collecting paddle
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/55/cf/e4b6b9a54d2f072e4491e34317bf5f5fea260da8a3072e641832dc9ce770/paddle-1.0.2.tar.gz (579kB)
     |████████████████████████████████| 583kB 1.4MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-na___dip/paddle/setup.py'"'"'; __file__='"'"'/tmp/pip-install-na___dip/paddle/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-na___dip/paddle/pip-egg-info
         cwd: /tmp/pip-install-na___dip/paddle/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-na___dip/paddle/setup.py", line 3, in <module>
        import paddle
      File "/tmp/pip-install-na___dip/paddle/paddle/__init__.py", line 5, in <module>
        import common, dual, tight, data, prox
    ModuleNotFoundError: No module named 'prox'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[root@localhost ~]# python3 -m pip install prox --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple
END

本文标题:Centos7运行python脚本时报错No module named 'paddle'

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202318596.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2023 年 07 月 18 日
如果觉得我的文章对你有用,请随意赞赏