ModuleNotFoundError: No module named 'sandbox'

刘超 1年前 ⋅ 5002 阅读   编辑

一、描述

  执行python3 manage.py runserver 0.0.0.0:8000,报如下错误

[root@VM_0_10_centos dataquality]# python3 manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
    raise _exception[1]
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute
    autoreload.check_errors(django.setup)()
  File "/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sandbox'

二、分析

  1、直接执行pip install sandbox,找不到,如下

[root@VM_0_10_centos dataquality]# pip install sandbox
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Collecting sandbox
  Could not find a version that satisfies the requirement sandbox (from versions: )
No matching distribution found for sandbox

  2、执行pip search sandbox,找到如下库

sandbox (0.3.5)                        
hackoregon-sandbox (1.64)              
sandbox-api (0.0.5)                    
little-sandbox-py (1.1.1)              
sandbox-python-structure (0.0.1)       
falcon-sandbox (1.0.0)                 
pyp-sandbox (7abc960)                  
caproto-sandbox (0.0.0)                
pypi-sandbox (0.0.0)                   
autograder-sandbox (3.1.2)             
Flask-Sandbox (0.1.0)                  
wc-sandbox (0.0.1)                     
mazgi-sandbox-4d36b809 (0.0.1)         
qs-cs-sandbox-extractor (0.0.2)        
example-pkg-mazgi-sandbox (0.0.1)      
sandboxlib (0.3.1)                     
vxsandbox (0.6.1)                      
rstsandbox (0.16.7)                    
pwnsandbox (0.31)                      
pyphysicssandbox (1.4.1)               
sandboxapi (1.5.1)                     
unittest_sandbox (1.1.0)   

  3、一个一个尝试, 安装ittle-sandbox-py后,不再报错

三、解决方法 

# python2
pip install little-sandbox-py
# python3
pip install little-sandbox-py


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: