Alembic在python虚拟环境中运行对我来说工作非常好。

然后几个小时前,当我运行任何Alembic命令时,我开始收到此错误,但我没有任何解释。

~/Desktop/cs/montage_web $ alembic upgrade head
Traceback (most recent call last):
  File "/Users/maxfowler/Dropbox/desktop/cs/virtualenvs/mweb/bin/alembic", line 9, in <module>
    load_entry_point('alembic==0.8.5', 'console_scripts', 'alembic')()
  File "/Users/maxfowler/Dropbox/desktop/cs/virtualenvs/mweb/lib/python2.7/site-packages/pkg_resources/__init__.py", line 474, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/maxfowler/Dropbox/desktop/cs/virtualenvs/mweb/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2582, in load_entry_point
    return ep.load()
  File "/Users/maxfowler/Dropbox/desktop/cs/virtualenvs/mweb/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2265, in load
    return self._load()
  File "/Users/maxfowler/Dropbox/desktop/cs/virtualenvs/mweb/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2268, in _load
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named config

最佳答案

终于找到了答案:

我不小心在存储库中的Alembic目录中添加了一个__init__.py文件,这使所有事情搞砸了(大概这使我的Alembic代码文件夹在Alembic python软件包之前被发现了,从而使事情出了问题)。

关于python - Alembic ImportError : No module named config,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36731845/

10-12 20:17