且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python:无法打开文件“ django-admin.py”:[Errno 2]没有这样的文件或目录

更新时间:2023-02-22 20:59:02

您正在混淆两种引用可执行文件的方式。

You're confusing two ways of referring to an executable file.

/ usr / local / bin 在您的路径中,而 django-admin.py 被标记为可执行文件,因此您可以在没有初始 python 的情况下引用它:

/usr/local/bin is in your path, and django-admin.py is marked as executable, so you can refer to it without the initial python:

django-admin.py startproject myproject

从 python ,即在此路径下使用脚本启动Python。因此,如果您要启动的脚本不在当前目录中,则需要传递完整路径。

When you start with python, that is saying "start Python with the script at this path". So, you need to pass the full path, if the script you're trying to start isn't in your current directory.