简体   繁体   中英

Anaconda overriding python as the default site-packages directory windows 7

from what I remember of middle school, anacondas and pythons are large snakes that overpower their prey, but anacondas are much bigger and heavier, which may be how it is overtaking my python pathway:

在此处输入图片说明

在此处输入图片说明

I installed psycopg2 with an easy .exe on windows 7 last night, and it worked (to the anaconda path)- but when I tried to start a Django app, it is looking in Python27\\lib\\site-packages. I allowed Anaconda to add itself to the pathway when I installed it because a post recommending it said to, and I also have Python set up correctly with a windows path variable.

This makes me wonder, should I actually uninstall python2.7.10, since Anaconda came with python 2.7.9 built in, and use the anaconda prompt for everything, and also delete python 2.7 from my path variable in windows? So,exactly

What is the best way to use Anaconda with Django?

I currently spent the weekend trying to tackle a similar issue. I have Anaconda (Miniconda3) installed for analytical work, however I also wanted to work on a Django project. In the end I ended up using an Anaconda virtual environment to work on my project. Here is basically what i did in cmd:

>mkdir mysite
>cd mysite
>conda create -n mysite-env python=3
>activate mysite-env
>conda install django

Basically this created a virtualenv in the envs folder in my Anaconda installation and I can create/work with django without having to worry about multiple python installations. Not sure if this is the best way, but its the way that works for me.

The issue you are having is that you may not have looked into what Anaconda is used for or what it solves. This step was pointed out in the installation steps when it adds Anaconda to your PATH. Being that Anaconda installs Python and has "environments" there is no reason to have 2 versions of the Python installation on your system, but Anaconda allows you to have different versions of Python with environments. Only one can use the "Python" command unless you execute it from the python.exe directory or make a separate alias as the python command and point it to the Anaconda or other Python installation. Again this is pointless as you can create a new environment with your Django project and requirements.

In short, having 2 separate Python installations is pretty much taking away what Anaconda helps solve.

In Windows 10, open Anaconda Navigator, search Not installed for 'django'. Click the check box, then hit Apply.

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