简体   繁体   English

如何使Django 1.7.1从Python 3.4.2可见?

[英]How do I make Django 1.7.1 visible from Python 3.4.2?

I installed Python 3.4.2 and Django 1.7.1 but I can import django only from Python 2.7. 我安装了Python 3.4.2和Django 1.7.1,但只能从Python 2.7导入django

I installed the latest version of Python from the official website and I installed Django with: 我从官方网站安装了最新版本的Python,并通过以下方式安装了Django:

pip install Django==1.7.1

you need to use the python 3.4.2 interpreter and it's own pip...you should look into virtualenv. 您需要使用python 3.4.2解释器,它是自己的pip ...您应该研究virtualenv。

docs for virtualenv: 用于virtualenv的文档:

http://virtualenv.readthedocs.org/en/latest/virtualenv.html http://virtualenv.readthedocs.org/en/latest/virtualenv.html

or you could run a command like this: 或者您可以运行以下命令:

$ /path/to/python3/lib/site-packages/pip install Django==1.7.1

EDIT: While my answer is possible, it is not recommended, rather you should use the following command like suggested by the other answer: 编辑:虽然我的答案是可能的,但不建议这样做,而是应该像其他答案一样使用以下命令:

$ pip<VERSION> install Django==1.7.1

since pip has supported this apparently since version 0.8 自从0.8版以来pip显然已经支持了这一点

Problem solved by installing Django with: 通过安装Django解决了以下问题:

pip3 install Django==1.7.1

The command pip seems to manage packages for one version of Python (2.7 here) and we should use it with Python version number to install package for a specific Python version. 命令pip似乎管理一个版本的Python(此处为2.7)的软件包,我们应该将其与Python版本号一起使用以安装特定Python版本的软件包。 Explanation here 在这里解释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM