鱼C论坛

 找回密码
 立即注册
查看: 3000|回复: 11

[已解决]import paddlehub as hub 语句红色波浪线

[复制链接]
发表于 2023-3-24 17:43:37 | 显示全部楼层 |阅读模式
10鱼币
由于需要使用 pallhub自动加标点,使用paddlehub,但是import paddlehub as hub 语句的paddlehub下有红色波浪线,运行提示:ModuleNotFoundError: No module named 'paddlehub'


  1. import base64
  2. import hashlib
  3. import hmac
  4. import json
  5. import os
  6. import re
  7. import time
  8. import urllib
  9. import requests

  10. import paddlehub as hub
复制代码
最佳答案
2023-3-24 17:43:38
wideband 发表于 2023-3-24 17:57
谢谢!

cmd 大量的输出,最后几段:


这是因为编译环境的问题导致的,我之前发过一个帖子 https://fishc.com.cn/thread-225497-1-1.html,你可以看看这个帖子


你执行这条命令安装应该就没问题了:

  1. pip install paddlehub -i https://mirrors.aliyun.com/pypi/simple --only-binary :all:
复制代码

最佳答案

查看完整内容

这是因为编译环境的问题导致的,我之前发过一个帖子 https://fishc.com.cn/thread-225497-1-1.html,你可以看看这个帖子 你执行这条命令安装应该就没问题了:
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-24 17:43:38 | 显示全部楼层    本楼为最佳答案   
wideband 发表于 2023-3-24 17:57
谢谢!

cmd 大量的输出,最后几段:


这是因为编译环境的问题导致的,我之前发过一个帖子 https://fishc.com.cn/thread-225497-1-1.html,你可以看看这个帖子


你执行这条命令安装应该就没问题了:

  1. pip install paddlehub -i https://mirrors.aliyun.com/pypi/simple --only-binary :all:
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-24 17:45:46 | 显示全部楼层
你安装paddlehub了吗?
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-24 17:51:39 | 显示全部楼层
在新建pycharm项目时,需要选择"inherit global packages"选项才可以使用pip安装的库。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-3-24 17:52:12 | 显示全部楼层
isdkz 发表于 2023-3-24 17:45
你安装paddlehub了吗?

谢谢您的支持!
我尝试安装如下,但是,都是一堆的问题,我用的是 3.11, pycharm-community-2022.3.3

pip install paddlehub
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-24 17:53:17 | 显示全部楼层
wideband 发表于 2023-3-24 17:52
谢谢您的支持!
我尝试安装如下,但是,都是一堆的问题,我用的是 3.11, pycharm-community-2022.3.3

...

有什么问题?把报错信息发出来看看
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-24 17:54:28 | 显示全部楼层
wideband 发表于 2023-3-24 17:52
谢谢您的支持!
我尝试安装如下,但是,都是一堆的问题,我用的是 3.11, pycharm-community-2022.3.3

...

用这条命令安装:

  1. pip install paddlehub -i https://mirrors.aliyun.com/pypi/simple
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-3-24 17:57:46 | 显示全部楼层
isdkz 发表于 2023-3-24 17:54
用这条命令安装:

谢谢!

cmd 大量的输出,最后几段:
  1. 6e/onnx-1.9.0.tar.gz (9.8 MB)
  2.   Installing build dependencies ... done
  3.   Getting requirements to build wheel ... error
  4.   error: subprocess-exited-with-error

  5.   × Getting requirements to build wheel did not run successfully.
  6.   │ exit code: 1
  7.   ╰─> [21 lines of output]
  8.       Traceback (most recent call last):
  9.         File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
  10.           main()
  11.         File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
  12.           json_out['return_val'] = hook(**hook_input['kwargs'])
  13.                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  14.         File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
  15.           return hook(config_settings)
  16.                  ^^^^^^^^^^^^^^^^^^^^^
  17.         File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-l_is9v7q\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
  18.           return self._get_build_requires(config_settings, requirements=['wheel'])
  19.                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  20.         File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-l_is9v7q\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
  21.           self.run_setup()
  22.         File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-l_is9v7q\overlay\Lib\site-packages\setuptools\build_meta.py", line 485, in run_setup
  23.           self).run_setup(setup_script=setup_script)
  24.                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  25.         File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-l_is9v7q\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
  26.           exec(code, locals())
  27.         File "<string>", line 86, in <module>
  28.       AssertionError: Could not find "cmake" executable!
  29.       [end of output]

  30.   note: This error originates from a subprocess, and is likely not a problem with pip.
  31. error: subprocess-exited-with-error

  32. × Getting requirements to build wheel did not run successfully.
  33. │ exit code: 1
  34. ╰─> See above for output.

  35. note: This error originates from a subprocess, and is likely not a problem with pip.

  36. C:\Users\Administrator>
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-3-24 18:07:55 | 显示全部楼层
isdkz 发表于 2023-3-24 18:04
这是因为编译环境的问题导致的,我之前发过一个帖子 https://fishc.com.cn/thread-225497-1-1.html,你 ...

谢谢您!我试试
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-24 18:21:45 | 显示全部楼层

不客气,有用的话记得给个最佳答案
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-3-24 18:22:21 | 显示全部楼层
isdkz 发表于 2023-3-24 18:04
这是因为编译环境的问题导致的,我之前发过一个帖子 https://fishc.com.cn/thread-225497-1-1.html,你 ...

谢谢! 应该是你说的这个情况,提示安装成功如下。
Installing collected packages: tensorboard-plugin-wit, pytz, pyasn1, cma, wheel, tensorboard-data-server, six, rsa, pyyaml, pyasn1-modules, protobuf, Pillow, oauthlib, numpy, MarkupSafe, markdown, itsdangerous, grpcio, colorama, cachetools, absl-py, Werkzeug, tb-paddle, requests-oauthlib, python-dateutil, Jinja2, google-auth, click, pandas, google-auth-oauthlib, flask, tensorboard, paddlehub
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.2 Pillow-9.4.0 Werkzeug-2.2.3 absl-py-1.4.0 cachetools-5.3.0 click-8.1.3 cma-2.7.0 colorama-0.4.6 flask-2.2.3 google-auth-2.16.2 google-auth-oauthlib-0.4.6 grpcio-1.51.3 itsdangerous-2.1.2 markdown-3.4.2 numpy-1.24.2 oauthlib-3.2.2 paddlehub-1.3.0 pandas-2.0.0rc1 protobuf-4.22.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 python-dateutil-2.8.2 pytz-2022.7.1 pyyaml-6.0 requests-oauthlib-1.3.1 rsa-4.9 six-1.16.0 tb-paddle-0.4.0 tensorboard-2.12.0 tensorboard-data-server-0.7.0 tensorboard-plugin-wit-1.8.1 wheel-0.40.0

只是,我在继续安装:
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple,又提示,您能看看乍回事吗?

ERROR: Could not find a version that satisfies the requirement paddlepaddle (from versions: none)
ERROR: No matching distribution found for paddlepaddle


小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-3-24 18:23:55 | 显示全部楼层
wideband 发表于 2023-3-24 18:22
谢谢! 应该是你说的这个情况,提示安装成功如下。
Installing collected packages: tensorboard-plugi ...

这是因为你写错了

pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple

这个库应该是 paddlehub,而不是 paddlepaddle
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-24 21:46

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表