【发布时间】:2015-06-21 11:14:56
【问题描述】:
我有 python 版本2.7.3,我想学习 django,所以我在我的 ubuntu 12.0.4 上安装了 django 版本 1.8.2。
invivtus@invictus:~/bin$ python
Python 2.7.3 (default, Sep 26 2013, 20:08:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 8, 2, 'final', 0)
然后我读到使用 django 的最佳方式是使用 python 版本3.3 所以我在我的系统上安装了 python 版本 3.3.6,其中 py 是指向 /opt/python3.3/bin/python3 的符号链接.3
invictus@invictus:~/bin$ py
Python 3.3.6 (default, Jun 21 2015, 16:13:35)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
当我尝试在这里导入 django 时出现错误
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'django
我看到 django 安装了我的 python 2.7 目录。
>>> import django
>>> django
<module 'django' from '/usr/local/lib/python2.7/dist-packages/django/__init__.pyc'>
如何在我的 3.3.6 版本中使用这个 django。我的默认 python 版本是 2.7.3 这里有哪些可能的锻炼方式?
【问题讨论】:
标签: python django python-2.7 python-3.x