Mr. Breakfast
Mr. Breakfast

Reputation: 51

"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

Upvotes: 0

Views: 795

Answers (2)

Chad Miller
Chad Miller

Reputation: 1475

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 .

Upvotes: 1

Mr. Breakfast
Mr. Breakfast

Reputation: 51

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).

Upvotes: 0

Related Questions