簡體   English   中英

python軟件包安裝時ImportError

[英]ImportError while python package installation

我正在完全按照docs http://django-wiki.readthedocs.io/en/latest/installation.html中的說明安裝django-wiki。

當我嘗試執行“ python manage.py migration”時,出現以下錯誤:

Traceback (most recent call last):                                                                                  
File "manage.py", line 13, in <module>                                                                            
  execute_from_command_line(sys.argv)                                                                             
File "/var/www/unihotel/common_apps_1/django/core/management/__init__.py", line 338, in execute_from_command_line 
  utility.execute()                                                                                               
File "/var/www/unihotel/common_apps_1/django/core/management/__init__.py", line 312, in execute                   
  django.setup()                                                                                                  
File "/var/www/unihotel/common_apps_1/django/__init__.py", line 18, in setup                                      
  apps.populate(settings.INSTALLED_APPS)                                                                          
File "/var/www/unihotel/common_apps_1/django/apps/registry.py", line 108, in populate                             
  app_config.import_models(all_models)                                                                            
File "/var/www/unihotel/common_apps_1/django/apps/config.py", line 198, in import_models                          
  self.models_module = import_module(models_module_name)                                                          
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module                                      
  __import__(name)                                                                                                
File "/usr/lib/python2.7/site-packages/wiki/models/__init__.py", line 10, in <module>                             
  from .article import *  # noqa                                                                                  
File "/usr/lib/python2.7/site-packages/wiki/models/article.py", line 14, in <module>                              
  from wiki.conf import settings                                                                                  
File "/usr/lib/python2.7/site-packages/wiki/conf/settings.py", line 3, in <module>                                
  import bleach                                                                                                   
File "/usr/lib/python2.7/site-packages/bleach/__init__.py", line 19, in <module>                                  
  from .sanitizer import BleachSanitizer                                                                          
File "/usr/lib/python2.7/site-packages/bleach/sanitizer.py", line 5, in <module>                                  
  from html5lib.constants import tokenTypes                                                                       
ImportError: cannot import name tokenTypes    

但是當我使用python shell導入它時...

>>> from html5lib.constants import tokenTypes
>>> print(tokenTypes)
{u'Comment': 6, u'StartTag': 3, u'EmptyTag': 5, u'Characters': 1, u'EndTag': 4, u'ParseError': 7, u'Doctype': 0, u'SpaceCharacters': 2}

...效果很好。

請,對此的任何幫助將是有用的!

問題是manage.py使用的是python解釋器以外的其他版本的html5lib 檢測到此錯誤的最簡單方法是直接轉到導致錯誤的軟件包文件,然后使用app.__version__打印出軟件包版本。 希望這對某人有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM