I had some problem on installing python + virtualenv + django and need help.
System: Windows 7, 64b
What i do? 1) Installed Python 2.7.2 (32bits) 2) Installed SetupTools (32 bits) 3) Installed VirtualEnv
E:\APPZ\Console2>C:\Python27\Scripts\easy_install.exe virtualenv
4) Created virtualenv:
E:\APPZ\Console2>virtualenv E:\CODE\wamp\www\AMBIENTES\env
5) Fine, now I created a ".bat" to use my env and put then in C:\Windows.
C:\Windows\python.bat
cmd.exe /k E:\CODE\wamp\www\AMBIENTES\env\Scripts\activate.bat
So far so good Now I executed the python.bat and installed django:
E:\APPZ\Console2>python
E:\APPZ\Console2>cmd.exe /k E:\CODE\wamp\www\AMBIENTES\env\Scripts\activate.bat
(env) E:\APPZ\Console2>cd E:\CODE\wamp\www\AMBIENTES\Django-1.2.7
(env) E:\CODE\wamp\www\AMBIENTES\Django-1.2.7>python setup.py install
django installed (1.2.7) successfully.
And now, the problem:
(env) E:\CODE\wamp\www\AMBIENTES\Django-1.2.7>E:\CODE\wamp\www\AMBIENTES\env\Scripts\django-admin.py --version
Traceback (most recent call last):
File "E:\CODE\wamp\www\AMBIENTES\env\Scripts\django-admin.py", line 2, in <module>
from django.core import management
ImportError: No module named django.core
(env) E:\CODE\wamp\www\AMBIENTES\Django-1.2.7>
-
Does anyone know what I can do about it?
Django can be installed easily using pip . In the command prompt, execute the following command: pip install django . This will download and install Django. After the installation has completed, you can verify your Django installation by executing django-admin --version in the command prompt.
In most simple way, a virtual environment provides you a development environment independent of the host operating system. You can install and use necessary software in the /bin folder of the virtualenv, instead of using the software installed in the host machine.
I know this question is old and maybe not actual anymore for author. But as far as it appears at Google's top, I would leave the answer that helped me.
Basically the correct answer is posted for the similar question.
Strictly speaking the wrong Python installation is called when you execute django-admin.py --version
. in order to check which Python you use in the case, type ftype Python.File
in "command line". If it's not the virtualenv's one, then you could reassociate the default Python:
ftype Python.File="E:\CODE\wamp\www\AMBIENTES\env\Scripts\python.exe" "%1" %*
Or unset the file association (from cmd.exe):
assoc .py=
ftype Python.File=
After you reassociate the .py
extension program, you should specify full path to execute Python files:
E:\CODE\wamp\www\AMBIENTES\env\Scripts\python.exe E:\CODE\wamp\www\AMBIENTES\env\Scripts\django-admin.py --version
Or if you want, you could edit virtualenv's activate.bat
to put specific .py
association, using assoc
and ftype
command line utils, mentioned above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With