简体   繁体   English

“导入错误:无法导入 Django。您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗?” 在自制软件上

[英]"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.

相关问题 Suddenly ImportError: Couldn't import Django。您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗? - Suddenly ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? 导入错误:无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗? - ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Django 错误 - 无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗? - Django Error - Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? 无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗? --> WSGI.PY 文件 - Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? --> WSGI.PY file 无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 上可用吗 - Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH ImportError: 无法导入 Django。 蟒蛇路径 - ImportError: Couldn't import Django. PYTHONPATH Heroku 部署失败:无法导入 Django。您确定已安装吗? - Heroku deploy failed: Couldn't import Django. Are you sure it's installed? “导入错误:无法导入 Django。” 即使在 Virtualenv 中拥有 Django - “ImportError: Couldn't import Django.” even after having Django in Virtualenv “导入错误:无法导入 Django。” 即使在 Virtualenv 中安装 Django 之后 - “ImportError: Couldn't import Django.” even after installing Django within Virtualenv 导入错误:无法导入 Django ... 您是否忘记激活虚拟环境? - ImportError: Couldn't import Django ... Did you forget to activate a virtual environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM