wideband 发表于 2023-3-24 17:43:37

import paddlehub as hub 语句红色波浪线

由于需要使用 pallhub自动加标点,使用paddlehub,但是import paddlehub as hub 语句的paddlehub下有红色波浪线,运行提示:ModuleNotFoundError: No module named 'paddlehub'


import base64
import hashlib
import hmac
import json
import os
import re
import time
import urllib
import requests

import paddlehub as hub

isdkz 发表于 2023-3-24 17:43:38

wideband 发表于 2023-3-24 17:57
谢谢!

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

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


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

pip install paddlehub -i https://mirrors.aliyun.com/pypi/simple --only-binary :all:

isdkz 发表于 2023-3-24 17:45:46

你安装paddlehub了吗?

歌者文明清理员 发表于 2023-3-24 17:51:39

在新建pycharm项目时,需要选择"inherit global packages"选项才可以使用pip安装的库。

wideband 发表于 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

isdkz 发表于 2023-3-24 17:53:17

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

...

有什么问题?把报错信息发出来看看

isdkz 发表于 2023-3-24 17:54:28

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

...

用这条命令安装:

pip install paddlehub -i https://mirrors.aliyun.com/pypi/simple

wideband 发表于 2023-3-24 17:57:46

isdkz 发表于 2023-3-24 17:54
用这条命令安装:

谢谢!

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─>
      Traceback (most recent call last):
      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>
          main()
      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
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      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
          return hook(config_settings)
               ^^^^^^^^^^^^^^^^^^^^^
      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
          return self._get_build_requires(config_settings, requirements=['wheel'])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      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
          self.run_setup()
      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
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      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
          exec(code, locals())
      File "<string>", line 86, in <module>
      AssertionError: Could not find "cmake" executable!
      

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

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

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

C:\Users\Administrator>

wideband 发表于 2023-3-24 18:07:55

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

谢谢您!我试试

isdkz 发表于 2023-3-24 18:21:45

wideband 发表于 2023-3-24 18:07
谢谢您!我试试

不客气,有用的话记得给个最佳答案{:5_109:}

wideband 发表于 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


isdkz 发表于 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
页: [1]
查看完整版本: import paddlehub as hub 语句红色波浪线