简体   繁体   English

在 Pycharm 上运行 django 时遇到问题

[英]Having trouble running django on Pycharm

I'm sure you guys have heard enough of these questions but I am a new programmer looking to start using Django. I have done pip install django and by the time it's almost done download I received a warning.我相信你们已经听够了这些问题,但我是一名希望开始使用 Django 的新程序员。我已经完成了pip install django ,当它几乎完成下载时,我收到了警告。

WARNING: The script django-admin.exe is installed in 'C:\Users\bryan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.警告:脚本 django-admin.exe 安装在“C:\Users\bryan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts”中,它不在路径上。 Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.考虑将此目录添加到 PATH,或者,如果您希望禁止显示此警告,请使用 --no-warn-script-location。

I have ignored this earlier and ran the command django-admin startproject and of course I receive another error.我之前忽略了这一点并运行了命令django-admin startproject ,当然我收到了另一个错误。 The term 'django-admin' is not recognized as the name of a cmdlet, function, script file, or operable program.术语“django-admin”未被识别为 cmdlet、function、脚本文件或可运行程序的名称。

Not quite what to do.不完全是做什么。 I need your help.我需要你的帮助。 Or at least direct me to a post similar to this matter.或者至少将我引导至与此事类似的帖子。 Thank you!谢谢!

I have tried redirecting the PATH with pip install--install-option="--prefix=C:\Users\bryan\PycharmProjects\mySite" django I saw this on another post and thought it would help but nothing really worked.我尝试使用pip install--install-option="--prefix=C:\Users\bryan\PycharmProjects\mySite" django我在另一篇文章中看到了这个,并认为它会有所帮助,但没有任何效果。

It looks like you have globally installed Python with locally installed Python packages.看起来你已经全局安装了 Python 和本地安装的 Python 包。

Option 1: try doing what Windows says: add the directory with locally installed Python packages to the Windows PATH.选项 1:尝试执行 Windows 所说的操作:将本地安装的 Python 软件包的目录添加到 Windows PATH。

Option 2: consider using virtual environments: https://docs.python.org/3/library/venv.html选项 2:考虑使用虚拟环境: https://docs.python.org/3/library/venv.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM