django-admin.py and virtualenv issue on Windows

后端 未结 6 2018
青春惊慌失措
青春惊慌失措 2021-02-08 03:28

In my system there is Django 1.2.3 installed system wide:

C:\\>python -c \"import django; print django.get_version()\"
1.2.3
C:\\>django-admin.py --version         


        
6条回答
  •  隐瞒了意图╮
    2021-02-08 04:07

    I had a similar problem on linux when I tried to use an already exisiting django project with a later installed virtualenv.

    Is it possible that django-admin.py of django 1.2.4 is not on your path but that django-admin.py of your django 1.2.3 install is?

    That would explain your output from

    C:\> dev\venv\Scripts\activate.bat
    (venv) C:\> python -c "import django; print django.get_version()"
    1.2.4
    (venv) C:\> django-admin.py --version
    1.2.3
    

    because the python command is on the path of your virtualenv but the django-admin.py file might not be.

    As to your second question (assuming my guess above is correct): sym-link the django-admin.py file into your C:\dev\venv\Scripts directory, although I am not sure how that works on windows (are you using Cygwin?).

    Of course you can always call it as python C:\path\to\django-admin.py (since the right python version is called) but of course that is a lot of typing.

提交回复
热议问题