简体   繁体   中英

“bash: django-admin: command not found” after running django-admin

I had similar problems with pip that was fixed with "python3 -m" but now after install Django I want to make a new project.

When I try to run "django-admin startproject..." I get "bash: django-admin: command not found".

I don't know if I should mention it but, this is in a virtualenv.

python3 -m pip freeze: Django==3.0.6

echo $PATH: /home/alatimer/Environments/DjangoTutoria_env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

My problem was i was using python version 2.7 in the venv instead of version 3.6.9.

I assume the older python couldn't recognize the commands (this even includes pip commands).

Your problem is that your shell doesn't know where that program is, and the places it searches doesn't have it.

Notably, the shell would look for a program specifically if the name were qualified some way, where you name a location at the start. So, you could use "/long/path/to/django-admin" or "./django-admin" (if it's in the "." current directory).

Always qualify names that aren't standard programs. It isn't safe to mutate PATH to include a path relative to your current directory . . Instead, name your personal programs with location when you run them, ./program .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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