use*_*620 11 django path virtualenv
So I have looked around at a lot of questions similar to mine, however I couldn't find a concrete answer. My comp specifications are Windows 7 64-bit.
My problem is as such:
1) I installed virtualenv using pip:
pip install virtualenv
Run Code Online (Sandbox Code Playgroud)
2) After that I created and activated a new environment:
path/virtualenv env
...
path/to/env/Scripts/activate
Run Code Online (Sandbox Code Playgroud)
3) While running the new environment, I installed django:
(env) path/pip install django
Run Code Online (Sandbox Code Playgroud)
4) After installing successfully, I am ready to make a project. However, upon trying it out:
path/django-admin.py startproject test
Run Code Online (Sandbox Code Playgroud)
I get the following error:
File "C:/path/env/Scripts/django-admin.py", line 2, in (module)
from django.core import management
ImportError: No module named django.core
Run Code Online (Sandbox Code Playgroud)
I have tried out various solutions people have posted, including using the full path:
python C:/path/to/django-admin.py startproject test
Run Code Online (Sandbox Code Playgroud)
我还检查过以确保它引用的Python版本是正确的,因为virtualenv内部和外部都与Python27相关联.许多其他解决方案都谈到了PYTHONPATH或syspath,但是,当我在python shell中导入django或managemnet时,这些工作正常.
我觉得它可能与路径有关,但我不确定virtualenv如何与系统路径交互.由于它是独立的并且系统路径是系统范围的,因此是否有必要在路径中具体使用某些东西?
顺便说一下,我的django-admin.py文件都在
path/env/Scripts
Run Code Online (Sandbox Code Playgroud)
和
path/env/Lib/site-packages/django/bin
Run Code Online (Sandbox Code Playgroud)
和django文件夹在
path/env/Lib/site-packages
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
小智 4
我也无法得到任何其他堆栈溢出答案。让 venved Django 堆栈在 Win64 上运行是一个考验。
但是,我在这里找到了一个对我有用的答案:http://samudranb.com/2012/06/02/how-to-setup-a-djangopython-development-env-on-windows/
尝试从管理命令提示符运行:
ftype Python.File="[your venv path]\Scripts\python.exe" "%1" %*
Run Code Online (Sandbox Code Playgroud)
完成后请务必将其设置回原始值。
归档时间: |
|
查看次数: |
8494 次 |
最近记录: |