PIP command for Django Installation [duplicate] - python

This question already has answers here:
pip is not recognized in Anaconda Prompt
(7 answers)
Closed 2 years ago.
I have installed python using Anaconda platform, The problem is that when I want to install Django through command prompt, it shows an error 'pip is not recognized as an internal or external command.'
Please suggest a solution. Thanks in advance. :)

AFAIK, In anaconda platform you can't use pip, you have to use conda.
And to install django in anaconda platform, try running the following command, conda install django.
Or try this url https://www.coresumo.com/install-django-on-anaconda/
you can also try conda install pip and then continue as normal python environment after creating the virtual environment.

try conda create --name myenv
and then activate the environment using myenv\source\activate and then install pip using
conda install pip after that you can install django.
follow this link after the process for better understanding and there also guide lines to install Django in the newly created virtual environment.

Just do these steps:-
1) create a virtual environment and activate the same virtual environment.
2) then install Django with pip.
If you are using Ubuntu then run below command on terminal.
$ mkvirtualenv <virtual_env_name> or virtualenv <virtual_env_name>
$ workon <virtual_env_name> or source <virtual_env_name>/bin/activate
$ conda install pip
$ conda install django or pip install django
for window user refer http://www.learnexia.com/?p=857 and https://anaconda.org/anaconda/django

Related

is it any quick way to install package in PyCharm using pip when using conda environment

I am using conda as the Python3 package management tool, sometimes the conda repo did not contains some Python package. So I have to install it using pip, first I found the anaconda environment folder, the next step switch to the anaconda environment folder:
cd /usr/local/anaconda3/envs/pydolphin
then using this command to install package:
./bin/pip install musicbrainzngs
is there any short way to do this? is it possible to install it the PyCharm IDE the simple way? the PyCharm IDE using conda install by default.
First activate your conda environment:
conda activate <env>
This will switch to the version of pip installed in this environment. Then you can install using pip as per normal which will install it into your conda environment:
pip install musicbrainzngs

Problems with python environnements in Anaconda

I have a problem with the management of my environnements on Anaconda. I want to have three environnements, a "classic", another with ortools and a last with django. However, ortools can't be installed by using "conda install ortools", then i have to use pip. My problem is that when i use "pip install --user ortools" in the right environnement it install this package for all my environnements which have the same version of python than the right environnement. How could I fix this ?
Thanks !
#lucidbrot is correct in their comment. You should not use the --user argument in pip, because that will install into your $HOME directory, which every environment can access.
Here is a series of commands you can use to set up multiple environments, one with ortools
conda create --name ortools-env python=3
conda activate ortools-env
python -m pip install --no-cache-dir ortools
python -c "import ortools" # No error.
conda create --name django-env python=3 django
conda activate django-env
python -c "import ortools" # Error: module not found
For reference, the above code uses conda version 4.8.2

Install Python 3.6.3 in Virtualenv using pip in WIndows 10?

How do you install Python 3.6.x in a virtualenv using pip in Windows 10?
pip install python, pip install python3, pip install python3.6 don't work.
Pip and virtualenv are two separate tools. Pip is a package manager, you will use it to install packages into your virtual environment once it has been set up. Pip does not actually manage the virtual environment. Virtualenv is the tool that handles creating virtual environments.
First, you should check if you have virtualenv installed with virtualenv --version. If you do not have it, you will get an error that virtualenv is not found. You can use pip to install virtualenv with pip install virtualenv.
Once you have virtualenv, you can create a python 3.6 environment with virtualenv -p python3.6 /path/to/myvirtualenv. You will need an installation of python 3.6 for this command to work, so download and install python 3.6 first if you do not have it.
I believe that on windows if you don't have python 3.6 in your PATH variable, you may need to point directly to the python 3.6 installation instead with virtualenv -p /path/to/mypython3.6 /path/to/myvirtualenv.
See Virtualenv User Guide

How to install Django Rest Framework using Anaconda?

Main OS I am using are Ubuntu and Windows.
I couldn't find the package in conda.I am using python 3.5.
DRF is now on conda-forge. You can install it by using:
conda config --add channels conda-forge
conda install djangorestframework
More information about conda-forge:
https://conda-forge.github.io/
I have installed it on win7 and ubuntu 16.10.
To install this package with conda run:
conda install -c anaconda django=1.10.5
activate myenv # windows cmd
source activate myenv # linux, MacOS
# Anaconda prompt
pip install djangorestframework
pip install markdown # Markdown support for the browsable API.
pip install django-filter # Filtering support
# verify
conda list # Now you should see it on your list
django takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. To install this package with conda run https://anaconda.org/anaconda/django :
conda install -c anaconda django
I just installed django 1.11.3 on Python 3.6.2 Anaconda, Windows 10
This answer was posted inside the question:
The easiest is to go in to conda environment and use pip inside to install Django by doing:
> activate $your_conda_env
> pip install djangorestframework
just typing
pip install django
pip install djangoframework
or use a virtual environment to install those packages for that, first you need to install a virtual environment
pip install virtualenv
then create a new directory and make new virtual environment eg:
mkdir django
cd django
virtualenv django_project1
source django_project1/bin/activate
pip install django
pip install djangoframework
this will install django framework inside the virtual environment
will install django framework in your computer. And also update your pip packages using
pip update $PKG_NAME
eg:
pip update python

How do I can install pip inside virtual environment

I have created one virtual-environment. Inside that I have to install few python packages. For that I need pip package inside virtual environment. How can I install pip inside virtual-environment?
According to the pip documentation, you can install pip in a virtual environment by typing the following command when your virtual environment is activated:
python -m ensurepip --upgrade
For your information, ensurepip is an in-built Python module that serves the purpose of installing pip in your Python environment.
you can also try with upgrading pip command even after no pip installed at you specified virtual location
python -m pip install --upgrade pip
This will give you an error as below but also install latest pip version on virtual location
Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-19.2.3
kindly try above option and let me in case any issue.
Usually, you install pip OUTSIDE of your virtual environment.
But after activating the virtualenv you just run "pip install" inside the environment.
Meaning, you install it outside the virtualenv.
You run "pip install" inside the virtualenv.
You can follow this useful guide:
http://docs.python-guide.org/en/latest/dev/virtualenvs/
When you create a virtual environment for a particular python revision installed in your computer, all the libraries currently installed in your python revision would be copied inside the virtual environment.
Pip is usually default available in your python revision directory.
If not, install it first in your original python install directory.
Then copy the pip.exe to the virtual environment's Scripts directory.
After that execute the below command from your terminal (this is for Windows):
\your_venv_directory_path\Scripts\pip.exe install --upgrade pip
Now you can just type
pip install --upgrade pip
and it should recognise the path to the pip.exe file inside your venv
when creating the virtual-environment, be sure to include pip in the command. e.g:
conda create -n my_env pip python=3.6.8
I would suggest deleting the venv and recreating it using the above command

Categories