在Windows Vista上遇到Django问题

时间:2011-07-05 12:46:21

标签: django command-line window

我安装了subversion,它似乎安装了Python25,我的电脑不会让我擦除,甚至可以识别控制面板上的程序。我将我的Python27 Python.py文件复制到Python 25文件夹中以替换Python.py(Python 25版本),并获得运行Python 27的命令提示符(即使我已经指定了Python 27文件夹,它仍然坚持运行Python 25)。我将Django主干复制到Django 27和Django 25的网站包中.Direct Django在Python中工作,但现在我收到了这个错误:

C:\Windows\system32>cd C:\Users\Susan\Documents\practice

C:\Users\Susan\Documents\practice>django-admin.py startproject mysite
Traceback (most recent call last):
File "C:\csvn\Python25\django-admin.py", line 2, in <module>
from django.core import management
  File "C:\csvn\Python25\lib\site-packages\django\core\management\__init__.py",
 line 7, in <module>
    from django.core.management.base import BaseCommand, CommandError, handle_de
fault_options
  File "C:\csvn\Python25\lib\site-packages\django\core\management\base.py", line
 14, in <module>
    from django.utils.encoding import smart_str
  File "C:\csvn\Python25\lib\site-packages\django\utils\encoding.py", line 2, in
 <module>
import urllib
  File "C:\csvn\Python25\lib\urllib.py", line 26, in <module>
    import socket
  File "C:\csvn\Python25\lib\socket.py", line 45, in <module>
import _socket
ImportError: Module use of python25.dll conflicts with this version of Python.

提前致谢。

哦,这是我的环境路径变量:C:\ Program Files \ SSH Communications Security \ SSH Secure Shell; C:\ Python27; C \ Python27 \ scripts; C:\ Python27 \ Lib \ site-packages \ django \ BIN \

这是我的python变量:C:\ Python27; C \ Python27 \ scripts; C:\ Python27 \ Lib \ site-packages \ django \ bin \


编辑:意识到USER路径与系统路径不同。使它们都一样,现在收到这条消息:

C:\Users\Susan\Documents\practice>django-admin.py startproject mysite
Traceback (most recent call last):
 File "C:\Python27\Lib\site-packages\django\django\bin\django-admin.py", line 2
,     in <module>
    from django.core import management
  File "C:\csvn\Python25\lib\site-packages\django\core\management\__init__.py",
line 7, in <module>
    from django.core.management.base import BaseCommand, CommandError, handle_de
 fault_options
  File "C:\csvn\Python25\lib\site-packages\django\core\management\base.py", line
 14, in <module>
    from django.utils.encoding import smart_str
  File "C:\csvn\Python25\lib\site-packages\django\utils\encoding.py", line 2, in
<module>
   import urllib
  File "C:\csvn\Python25\lib\urllib.py", line 26, in <module>
    import socket
  File "C:\csvn\Python25\lib\socket.py", line 45, in <module>
    import _socket

ImportError:DLL加载失败:找不到指定的模块。

为什么一直尝试使用Python25?

1 个答案:

答案 0 :(得分:0)

我会从你的机器上卸载Python 2.7和2.5并重新安装Python 2.7。在考虑安装Django之前,你必须安装一个可用的Python。

在此之后,我建议安装virtualenvJustin Driscoll's virtualenv helper for Windows

Virtualenv允许您创建不同的Python运行时,因此您无需将模块直接安装到系统Python Path中。安装virtualenv会让你用来安装像Django这样的模块到你的virtualenv的site-packages文件夹中。