NoModuleError…..持续

2024-10-03 19:29:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我运行了代码pip install progressbar,它运行成功,但是当我试图在SPYDER IDE中使用它时,它不起作用,并且没有给出名为“progressbar”的模块。请帮助

这是我在cmd中运行的输出

C:\WINDOWS\system32>pip install progressbar
Collecting progressbar
  Using cached https://files.pythonhosted.org/packages/a3/a6/b8e451f6cff1c99b4747a2f7235aa904d2d49e8e1464e0b798272aa84358/progressbar-2.5.tar.gz
Building wheels for collected packages: progressbar
  Building wheel for progressbar (setup.py) ... done
  Stored in directory: C:\Users\arish\AppData\Local\pip\Cache\wheels\c0\e9\6b\ea01090205e285175842339aa3b491adeb4015206cda272ff0
Successfully built progressbar
Installing collected packages: progressbar
Successfully installed progressbar-2.5

这是我在spyder中运行的代码:

from progressbar import ProgressBar
pbar = ProgressBar()
for x in pbar(50):
    print(x)

这就是我犯的错误

runfile('C:/Users/arish/trialprogbar.py', wdir='C:/Users/arish')
Traceback (most recent call last):

  File "<ipython-input-3-3c2e1e78ee9d>", line 1, in <module>
    runfile('C:/Users/arish/trialprogbar.py', wdir='C:/Users/arish')

  File "C:\Users\arish\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile
     execfile(filename, namespace)

  File "C:\Users\arish\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/arish/trialprogbar.py", line 1, in <module>
    from progressbar import ProgressBar

ModuleNotFoundError: No module named 'progressbar'

Tags: pipinpyforpackageslineusersfile