I've been trying to execute django-admin from within a LiClipse project using:
projectName = "someProject"
command = 'django-admin startproject ' + projectName
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
and also
subprocess.check_call(shlex.split(command))
But each time I get the error:
FileNotFoundError: [Errno 2] No such file or directory: 'django-admin'
However, when I run the same program from the Linux terminal using python3 main.py, it works fine.
So I figured it might be because django-admin's path isn't added to PYTHONPATH. I did a locate "django-admin" to find these paths:
/home/nav/.pyenv/shims/django-admin
/home/nav/.pyenv/shims/django-admin.py
/home/nav/.pyenv/versions/3.8.7/bin/django-admin
/home/nav/.pyenv/versions/3.8.7/bin/django-admin.py
/home/nav/.pyenv/versions/3.8.7/bin/__pycache__/django-admin.cpython-38.pyc
/home/nav/.pyenv/versions/3.8.7/lib/python3.8/site-packages/django/bin/django-admin.py
/home/nav/.pyenv/versions/3.8.7/lib/python3.8/site-packages/django/bin/__pycache__/django-admin.cpython-38.pyc
...but I get the same error when I run the program from within LiClipse.
Does anyone know why this problem is happening and how it can be fixed?

django-admincommand you want executed or you properly setup pyenv so that Eclipse doesn't need additional configuration. The shims are already there.export PATH="/home/nav/.pyenv/versions/3.8.7/bin/:$PATH"to ~/.bashrc. Restarted computer. Am getting the sameFileNotFoundError: [Errno 2] No such file or directory: 'django-admin'error.python3 main.pyprint(os.environ['PATH'])before invoking subprocess. Compare the difference when invoked from Eclipse versus the command line.