我正在尝试在虚拟环境中从我的项目目录运行 python manage.py shell_plus --notebook
。该命令以前有效,但现在不再有效,我认为问题一定是某些软件包版本冲突。
我有一个安装了以下软件包的虚拟环境:
Package Version
-------------------- -----------
appnope 0.1.3
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
asgiref 3.5.2
asttokens 2.0.5
attrs 21.4.0
backcall 0.2.0
backports.zoneinfo 0.2.1
beautifulsoup4 4.11.1
bleach 5.0.0
cffi 1.15.0
debugpy 1.6.0
decorator 5.1.1
defusedxml 0.7.1
dj-database-url 0.5.0
Django 4.0.4
django-extensions 3.1.5
django-heroku 0.3.1
django-on-heroku 1.1.2
entrypoints 0.4
executing 0.8.3
fastjsonschema 2.15.3
gunicorn 20.1.0
importlib-resources 5.7.1
ipykernel 6.13.0
ipython 8.3.0
ipython-genutils 0.2.0
ipywidgets 7.7.0
jedi 0.18.1
Jinja2 3.1.2
jsonschema 4.5.1
jupyter 1.0.0
jupyter-client 7.3.1
jupyter-console 6.4.3
jupyter-core 4.10.0
jupyterlab-pygments 0.2.2
jupyterlab-widgets 1.1.0
MarkupSafe 2.1.1
matplotlib-inline 0.1.3
mistune 0.8.4
nbclient 0.6.3
nbconvert 6.5.0
nbformat 5.4.0
nest-asyncio 1.5.5
notebook 6.4.11
numpy 1.22.3
packaging 21.3
pandocfilters 1.5.0
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
pip 22.1
prometheus-client 0.14.1
prompt-toolkit 3.0.29
psutil 5.9.0
psycopg2 2.9.3
psycopg2-binary 2.9.3
ptyprocess 0.7.0
pure-eval 0.2.2
pycparser 2.21
Pygments 2.12.0
pyparsing 3.0.9
pyrsistent 0.18.1
python-dateutil 2.8.2
pyzmq 22.3.0
qtconsole 5.3.0
QtPy 2.1.0
scipy 1.8.1
Send2Trash 1.8.0
setuptools 49.2.1
six 1.16.0
soupsieve 2.3.2.post1
sqlparse 0.4.2
stack-data 0.2.0
terminado 0.15.0
tinycss2 1.1.1
tornado 6.1
traitlets 5.2.1.post0
wcwidth 0.2.5
webencodings 0.5.1
whitenoise 6.1.0
widgetsnbextension 3.6.0
zipp 3.8.0
django-heroku
和 psycopg2
一样安装,但不知何故我仍然不断收到此错误。我在 Stackoverflow 上尝试了所有方法(甚至完全重新安装了 Python),但没有解决这个问题。
Python 版本:Python 3.8.9
机器:Macbook Pro with M1 chip
将不胜感激任何帮助!谢谢!
更新:
不知何故,解决问题的是运行 ./manage.py shell_plus --notebook
而不是 python manage.py shell_plus --notebook
。我不明白为什么这解决了问题,如果有办法让命令也可以与 python
一起运行,那就太好了!感谢您的意见!
回答1
你跑了吗:
pip install django-heroku
您需要通过运行安装 psycopg2:
pip install psycopg2
这是安装它的唯一方法。如果这不能解决错误。我认为您需要在 settings.py 文件中共享您的 heroku 设置。