gpt4 book ai didi

python - 没有名为 sqlalchemy 的模块

转载 作者:行者123 更新时间:2023-12-05 05:18:16 25 4
gpt4 key购买 nike

我尝试过使用 sudo easy_install sqlalchemy、pip install sqlalchemy 和 pip install flask-sqlalchemy。我也试过安装和卸载 sqlalchemy 和 flask。我得到错误

Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/hupper/worker.py", line 264, in worker_main
func(*spec_args, **spec_kwargs)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 40, in main
return command.run()
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 222, in run
app_spec, name=app_name, relative_to=base, global_conf=vars)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
File "/home/j/Downloads/ng-website-master/ngse/__init__.py", line 15, in main
config.include('.models')
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 776, in include
c = self.maybe_dotted(callable)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 876, in maybe_dotted
return self.name_resolver.maybe_resolve(dotted)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/pyramid/path.py", line 320, in maybe_resolve
return self._resolve(dotted, package)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/pyramid/path.py", line 327, in _resolve
return self._zope_dottedname_style(dotted, package)
File "/home/j/Downloads/ng-website-master/venv/local/lib/python2.7/site-packages/pyramid/path.py", line 382, in _zope_dottedname_style
__import__(used)
File "/home/j/Downloads/ng-website-master/ngse/models/__init__.py", line 4, in <module>
import zope.sqlalchemy
ImportError: No module named sqlalchemy

即使在尝试升级 sqlalchemy 之后,我仍然遇到上述错误。

Requirement already up-to-date: sqlalchemy in ./venv/lib/python2.7/site-packages

试过升级flask-sqlalchemy,还是报同样的错误

Requirement already up-to-date: flask-sqlalchemy in ./venv/lib/python2.7/site-packages
Requirement already up-to-date: SQLAlchemy>=0.8.0 in ./venv/lib/python2.7/site-packages (from flask-sqlalchemy)
Requirement already up-to-date: Flask>=0.10 in ./venv/lib/python2.7/site-packages (from flask-sqlalchemy)
Requirement already up-to-date: itsdangerous>=0.21 in ./venv/lib/python2.7/site-packages (from Flask>=0.10->flask-sqlalchemy)
Requirement already up-to-date: Jinja2>=2.4 in ./venv/lib/python2.7/site-packages (from Flask>=0.10->flask-sqlalchemy)
Requirement already up-to-date: Werkzeug>=0.7 in ./venv/lib/python2.7/site-packages (from Flask>=0.10->flask-sqlalchemy)
Requirement already up-to-date: click>=2.0 in ./venv/lib/python2.7/site-packages (from Flask>=0.10->flask-sqlalchemy)
Requirement already up-to-date: MarkupSafe>=0.23 in ./venv/lib/python2.7/site-packages (from Jinja2>=2.4->Flask>=0.10->flask-sqlalchemy)

我正在尝试在 virtualenv 中安装 use sqlalchemy。我还有 python=2.7.14、pip=9.0.1、setuptools=38.2.5 和应该安装的 sqlalchemy=1.2.0。我使用 supposed 是因为当我尝试升级和检查 sqlalchemy 和 flask-sqlalchemy 的版本时,我的计算机显示它已安装但我无法使用它。

这是我打印 sys.path 时得到的结果

['', '/usr/lib/python2.7', 
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/home/j/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages',
'/usr/local/lib/python2.7/dist-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/dist-packages/SQLAlchemy-1.2.0-py2.7-linux-x86_64.egg',
'/usr/lib/python2.7/dist-packages']

请帮帮我。我不知道还能做什么

最佳答案

你的 pip install 是错误的。

将 sqalchemy 更改为 sqlalchemy,因此它是:

pip install sqlalchemy

并确保在激活的 virtualenv 中执行此操作。

关于python - 没有名为 sqlalchemy 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48055596/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com