[英]"ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable?" On homebrew
This is a typical problem but I couldn't find any solution in other threads.这是一个典型的问题,但我在其他线程中找不到任何解决方案。 Here's my setup: MacOS Big Sur -> homebrew -> python3.9 I am running in a virtual environment, I've also manually de~ and activated it several times.
这是我的设置:MacOS Big Sur -> homebrew -> python3.9 我在虚拟环境中运行,我也手动 de~ 并多次激活它。 I've checked
wsgi.py
.我检查过
wsgi.py
。 All requirements are installed properly.所有要求都已正确安装。 Here's what brew says about pythonpath:
以下是 brew 关于 pythonpath 的说明:
% brew link --overwrite python@3.9 Warning: Already linked: /usr/local/Cellar/python@3.9/3.9.7_1 To relink, run: brew unlink python@3.9 && brew link python@3.9
Same error again又是同样的错误
% brew unlink python@3.9 && brew link python@3.9 Unlinking /usr/local/Cellar/python@3.9/3.9.7_1... 24 symlinks removed. Linking /usr/local/Cellar/python@3.9/3.9.7_1... 24 symlinks created.
I've tried doing what it suggests and un~ and linking python.我试过按照它的建议去做,然后 un~ 并链接 python。 Still no luck.
仍然没有运气。 That were all I could find on SO.
这就是我能在 SO 上找到的全部内容。 Maybe I'm missing something?
也许我错过了什么? Or is there a way to analyze the problem I'm not aware of?
或者有没有办法分析我不知道的问题?
Based on Shreeyansh Jain's reply to the original post.基于 Shreeyansh Jain 对原始帖子的回复。 Indeed, that's something I didn't do.
确实,那是我没有做的事情。 I've actually checked python versions as well:
我实际上也检查了 python 版本:
% python -V
Python 3.9.7
% python3 -V
Python 3.9.7
Don't let this confuse you.不要让这让你感到困惑。 Running
python3
instead of python
despite seeming lack of difference is what I was missing.尽管似乎缺乏差异,但运行
python3
而不是python
是我所缺少的。 Hope it helps someone =)希望它可以帮助某人 =)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.