Reputation: 2114
Im unable to start new project in a virtualenv. This is what i did so far: (fresh windows installation)
1) installed python 2.7 from http://python.org/download/ (not the 64 one)
2) using "set path=%path%;C:\python27" only seems to work for one cmd session, so i added C:\Python27; in my environment variables under advanced system settings, typing python in cmd returns
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
3) downloaded virtualenv.py from http://pypi.python.org/pypi/virtualenv/ ran it with:
C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS>python virtualenv.py testenv
New python executable in testenv\Scripts\python.exe
Installing setuptools....................................done.
Installing pip.........................done.
4) activated it and installed some modules
C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS\testenv\Scripts>activate
(testenv) C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS\testenv\Scripts>
...
(testenv) C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS>pip install -r requirements.txt
...
Successfully installed...
5) tested if it works:
testenv) C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS\testenv>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.4
>>>
6) Tried to setup a project:
(testenv) C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS\testenv>django-admin.py startproject testproject
Traceback (most recent call last):
File "C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS\testenv\Scripts\django-admin.py"
, line 2, in <module>
from django.core import management
ImportError: No module named django.core
Path from virtualenv:
(testenv) C:\Users\Maciej\Dropbox\VIRTUALENV_ENVS\testenv>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['','C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\lib\\site-packages\\pip-1.1-py2.7.egg',
'C:\\Windows\\system32\\python27.zip',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\DLLs',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\lib',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\lib\\plat-win',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\lib\\lib-tk',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\Scripts',
'C:\\Python27\\Lib',
'C:\\Python27\\DLLs',
'C:\\Python27\\Lib\\lib-tk',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv',
'C:\\Users\\Maciej\\Dropbox\\VIRTUALENV_ENVS\\testenv\\lib\\site-packages']
I have no idea whats the problem, and how to fix it, also got another question, are those files from c:\python27 supposed to be in my virtualenv path? Should i attach any other logs? Poke me if so.
Upvotes: 4
Views: 3819
Reputation: 2586
Please go through the below given tutorial link..
http://ayarshabeer.com/post/50973941605/install-multiple-django-version-using-virtualenvwrapper
Upvotes: 1
Reputation: 1257
Instead of using virtualenv, on Windows I prefer to use Portable Python : http://www.portablepython.com/. You can have several installations on the same machine and switch between them just by setting the path:
set path=d:\python\app\scripts;d:\python\app;%path%
Moreover, it already contains Django. Once you have set up your python environment, you can copy your python directory over to your production server.
Upvotes: -2
Reputation: 599590
I agree with jtiai, things go wrong in step 6 because Windows has bound a specific Python. If you did python path/to/django-admin.py startproject
it should work.
Upvotes: 2
Reputation: 611
Step 6 is where things start to go wrong
Your windows has bound .py(w) files to use Python from c:\python27 directory, not from your virtualenv.
I've written blog entry about virtualenv and win7: http://djangonautlostinspace.wordpress.com/2012/04/16/django-and-windows/
Upvotes: 3