社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Django

把网站项目从电脑A copy到电脑B,python manage.py runserver之后,出现ImportError: cannot import name 'generic',之前在电脑A可以正常runserver,进入页面

eddie • 8 年前 • 3354 次点击  

cmd中,完成错误代码如下:

C:\Users\Derong Qiu\Desktop\yangyangstudio>python manage.py runserver
Unhandled exception in thread started by <function checkerrors.<locals>.wrapper at 0x000002037F4FA400>
Traceback (most recent call last):
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(args, kwargs)
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\commands\runserver.py", line 109, in innerrun
    autoreload.raiselastexception()
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\autoreload.py", line 249, in raiselastexception
    six.reraise(exception)
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\six.py", line 685, in reraise
    raise value.withtraceback(tb)
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(args, kwargs)
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\init.py", line 18, in setup
    apps.populate(settings.INSTALLEDAPPS)
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\apps\registry.py", line 108, in populate
    appconfig.importmodels(allmodels)
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\django\apps\config.py", line 202, in importmodels
    self.modelsmodule = importmodule(modelsmodulename)
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\importlib\init.py", line 126, in importmodule
    return bootstrap.gcdimport(name[level:], package, level)
  File "<frozen importlib.bootstrap>", line 986, in gcdimport
  File "<frozen importlib.bootstrap>", line 969, in findandload
  File "<frozen importlib.bootstrap>", line 958, in findandloadunlocked
  File "<frozen importlib.bootstrap>", line 673, in loadunlocked
  File "<frozen importlib.bootstrapexternal>", line 662, in execmodule
  File "<frozen importlib.bootstrap>", line 222, in callwithframesremoved
  File "C:\Users\Derong Qiu\AppData\Local\Programs\Python\Python35\lib\site-packages\threadedcomments\models.py", line 3, in <module>
    from django.contrib.contenttypes import generic
ImportError: cannot import name 'generic'

在电脑A里面运行的好好的,两个电脑都是win10. 电脑A和电脑B的python版本都是3.5.1,django版本都是1.9.7. 求指教,有没有可能是电脑B里面有些package还没有pip install?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1707
 
3354 次点击  
文章 [ 3 ]  |  最新文章 8 年前
六月飞刀
Reply   •   1 楼
六月飞刀    8 年前

最好是重新安装所有环境或者用 virtuenv 进行控制

eddie
Reply   •   2 楼
eddie    8 年前

问题解决了,确实是一个package的版本不对。 前车之鉴。

eddie
Reply   •   3 楼
eddie    8 年前

是不是需要在电脑A中pip list,然后把所有package都按照相应的版本pip install下来