"sudo pip install Django" => sudo: pip: command not found - python

This what my terminal is saying when trying to install Django.
MacBook-XXXX:~ Stephane$ sudo pip install Django
sudo: pip: command not found
I have tested in idle shell if pip is installed:
>>> import easy_install
>>> import pip
>>>
What am I doing wrong?

you need to install pip
sudo easy_install pip

pip is a package management system used for installing packages written in python. So first install pip and then Django.
sudo apt-get install python-pip.
And for installing django, follow
django installation steps.

Related

Pip Install keeps installing libraries to Python2.7 rather than Python3

I'm trying to install modules such as gitpython into my Python3 directory however when I run:
Pip install gitpython it automatically downloads it into python2.7
I've tried specify the Python3 directory but it says the the library has already been installed.
Requirement already satisfied: gitpython in /usr/local/lib/python2.7/dist-packages (2.1.11)
Problem is when I try to call from git import repo my Python3 can't find the module.
Is there anyway to get pip to install my libraries to Python3 as a default, can I just uninstall Python 2.7 to save problems?
I run
sudo apt install python3-pip
and it states it is already installed, so I run sudo pip3 install gitpython and it says Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip
SOLUTION
sudo apt-get remove python3-pip; sudo apt-get install python3-pip
It depends of your version of pip. But I think that python3-pip may do the trick.
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
You should use pip3 to install your packages in your python3 environment. thus instead of installing with pip use pip3 install gitpython
You can try to see the version of python with:
python --version
if the result is python 2.7, that means that your environment variable for python3 needs to be set.
After that you can try:
python -m pip install package_name
I hope it will help you =)
Adrien
You should use python3 venv Python 3 venv
python3 -m venv /path/virtual/environment
source /path/virtual/environment/bin/activate
or use pip3 to installing any libraries for python 3
$ pip3 install 'some library'
You should create virtual environment for python3. using:
virtualenv -p /usr/bin/python3 <VIRTUAL_ENV NAME>
Then activate it using:
source <VIRTUAL_ENV NAME>/bin/activate
Then install your dependency(gitpython in your case) into that.

How to update Python pip?

I've had to install Python packages and libraries using pip, but every time I do, it says I'm using an older version of pip, and that v18.1 is available by running the command
python -m pip install --upgrade pip
When I run this command, it just says the same thing. It apparently can't update itself because it's outdated. Is there any way to get around this, maybe by manually updating it?
Thanks in advance, community!
Update: The OS I'm using is currently Windows 10 and Python 3.6.4. The following screenshot is what outputs when running the command.
Upgrading pip
On Linux or macOS:
pip install -U pip
On Windows:
python -m pip install -U pip
Try with "python -m pip install --upgrade pip --user"
It worked with me and I am with Win10.
If you are on linux try this -
sudo su root
apt-get purge -y python-pip
wget https://bootstrap.pypa.io/get-pip.py
python ./get-pip.py
apt-get install python-pip
or
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
On OS X this worked for me
python -m pip install --upgrade pip

"google-oauthlib-tool: command not found" when trying to install google assistant on raspbian

I'm trying to install google assistant on a newly set up pi 3 with Raspbian. I got the message "No module named googlesamples.assistant.auth_helpers" so I followed the instructions given in answer to this question: No module named googlesamples.assistant.auth_helpers
The first 2 commands appear to complete OK, but the third command gives
"google-oauthlib-tool: command not found"
My programming skills are too rusty to work out what's going wrong.
Python 3.5.3; forgotten how to find the version of SDK, but should be the latest one.
Any help greatly appreciated.
Have you followed the instructions to set up a virtual Python environment?
sudo apt-get update
sudo apt-get install python3-dev python3-venv
# Use python3.4-venv if the package cannot be found.
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools
source env/bin/activate
Then you should be able to install the oauth tool with pip:
python -m pip install --upgrade google-auth-oauthlib[tool]
You can display all of your installed packages using pip freeze
pip freeze | grep google
Before running python -m pip install --upgrade google-auth-oauthlib[tool] , run
pip install google-auth
And then:
python -m pip install --upgrade google-auth-oauthlib[tool]
google-auth is a dependency of google-auth-oauthlib in Raspbian
You need to locate the tool via locate google-oauthlib-tool
Then, cd into the path and open it there with your arguments

Where exactly is pip installed?

I know the newer versions of python come with pip installed. So 'sudo apt-get install python3-pip' gives me that it is installed saying that it is the latest version, then why does 'pip install django' gives an error saying pip is not insatlled? Namely this:
The program 'pip' is currently not installed. You can install it by typing:
sudo apt-get install python-pip
I again run 'sudo apt-get install python-pip' (for python 2.7) which installs version 1.5. So i try pip install -U pip and it downloads the package marked 7.1 and succesfully installs. However on checking the version again it is still 1.5
You can install pip with the help of get-pip.py script.
you can download this script and execute on your terminal "python get-pip.py".
it will install pip on your system.
you can also use curl to download get-pip.py script-
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py".
To verify the installation you can use-
pip --help
pip -V

How to install Django in Ubuntu 11.10

I am very new to Ubuntu OS and Python as well. I want to install Django. But i dont have easy_install and I tried below command to install pip
sudo apt-get install python-pip
I got an error as below
Unable to locate package python-pip
I tried below command as well
sudo apt-get install python-pip
and i got error as below
E: Package 'python-setuptools' has no installation candidate
I am very confused in installing django, How to successfully install django
First update repositories
sudo apt-get update
then try
sudo apt-get install python-pip python-dev build-essential python-setuptools
if nothing, you can install pip and setuptools packages manually. Download them from PyPI.
Install pip
To install or upgrade pip, securely download get-pip.py.
Then run the following (which may require administrator access):
sudo python get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.
To upgrade an existing setuptools (or distribute), run pip install -U setuptools
Upgrade pip
On Linux or OS X:
sudo pip install -U pip
Then you can download django using pip,
sudo pip install django
Install
First you need make sure you have Python install, here I take 2.7.6 as example. For how to install Python, you can go check this link:
https://askubuntu.com/questions/443048/python-2-7-6-on-ubuntu-12-04-how-to
Then you can start install Django and setup database as follow:
sudo apt-get install python-django
sudo apt-get install mysql-server
sudo apt-get install python-mysqldb
You can find more configuration detail in this link
http://yuwenqing.org/?p=108
Also, for less pain in future develop, you should deploy your Django application in python virtualEnv, here are some detail of why you need virtualEnv.
http://yuwenqing.org/?p=126

Categories

Resources