I'm runnning a virtualenv in the django-web folder. The folder has a Scripts folder which contains the python file django-admin.py. I would like to run this python file as: python django-admin.py from C:\Users\name\django-web with the virtualenv activated. The python file isn't found unfortunatly:
python: can't open file 'django-admin.py': [Errno 2] No such file or directory
when I look for the pythonpath in my virtual env:
(django-web) C:\Users\name\django-web>python Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (In tel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import sys; print(sys.path) ['', 'C:\Users\name\django-web\lib\site-packages\django-1.6.5-py3.4.egg' , 'C:\Python34\Lib', 'C:\Python34\DLLs', 'C:\Windows\system32\python34.zi p', 'C:\Users\name\django-web\DLLs', 'C:\Users\name\django-web\lib', 'C:\Users\name\django-web\Scripts', 'C:\Users\name\django-web', 'C:\ \Users\name\django-web\lib\site-packages']
The path 'C:\Users\name\django-web\Scripts' where the file is located is clearly in the python path.
Running the file as python Scripts\django-admin.py from C:\Users\name\django-web runs fine.
PYTHONPATHis irrelevant;PYTHONPATHis only used when importing inside a Python script or module, not when finding executables or scripts. You should indeed run the script with its full path, as you mention in the last line. Alternatively, you'd have to make sure yourPATHenvironment variable includesC:\Users\name\django-web\Scripts, and then you should be able to simple rundjango-admin.py(withoutScripts` orpython ` prepended.