无法在Python3.4中导入Django
我是Ubuntu新手(14.04)。我刚刚使用无法在Python3.4中导入Django,python,django,python-3.x,ubuntu-14.04,Python,Django,Python 3.x,Ubuntu 14.04,我是Ubuntu新手(14.04)。我刚刚使用sudopipsinstalldjango安装了django 这就是正在发生的事情: rpr@rpr-Inspiron-3521:~$ python Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
sudopipsinstalldjango
安装了django
这就是正在发生的事情:
rpr@rpr-Inspiron-3521:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>
rpr@rpr-Inspiron-3521:~$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'django'
>>>
rpr@rpr-Inspiron-3521:~$python
Python 2.7.6(默认,2014年3月22日,22:59:56)
[GCC 4.8.2]关于linux2
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>进口django
>>>
rpr@rpr-Inspiron-3521:~$python3
Python 3.4.0(默认值,2014年4月11日,13:05:11)
[GCC 4.8.2]在linux上
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>进口django
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为“django”的模块
>>>
我应该怎么做才能使用Python3.4中的Django?pip大概是为Python2安装的,而不是为Python3安装的。您可能有一个名为
pip3
的版本,它以Py3为目标
不过,最好使用virtualenv。只要写下:
sudo pip3 install Django
但最好像丹尼尔说的那样使用virtualenv
如果无法运行pip3,请使用以下软件安装:
检查我的解决方案。它解释了如何安装pip3
sudo apt-get install python3-setuptools
sudo easy_install3 pip