如何在现有的旧版本venv中使用Django和python3?

2024-04-24 12:22:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我做了很多关于它的研究,但它似乎让我困惑,因为每个人都说不同的事情,他们没有处理虚拟环境的具体情况。你知道吗

我在Mac OS X上。 我在the Heroku tutorial之后的虚拟环境中使用了django1.6和python2.7.5。你知道吗

现在,我只想更新到django1.7+python3.3.5。你知道吗

我所做的事情:

  • 我使用官方的Python包(在系统中)在MacOSX上安装了python3.3.5
  • 我使用pip安装了django1.7(仅在我的虚拟环境中)

现在:

python --version
>>> Python 2.7.5
python3 --version
>>> Python 3.3.5

Django使用我的系统中安装的Python3.3.5执行时缺少哪些步骤?

在我的Django项目中,我有一个venv文件夹。键入ls venv/binls venv/lib仅给出python2.7结果。没有Python的踪迹。你知道吗

另一件事表明Django与Python3没有“联系”:

foreman run python manage.py runserver
>>>Python 2.7.5 (default, Mar  9 2014, 22:15:05)

foreman run python3 manage.py runserver
>>>Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named 'django'

谢谢你的帮助。你知道吗


Tags: djangorunpymanagevenvversion系统line