简体   繁体   中英

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.

I installed the latest version of Python from the official website and I installed Django with:

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.

docs for virtualenv:

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

Problem solved by installing Django with:

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. Explanation here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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