At first, I was trying to install evo (a package for SLAM research) from source and I encountered an error:
ModuleNotFoundError: No module named 'numpy'
So then I tried to install numpy using pip install numpy. However I encountered another error:
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
Finally, I tried to install python-dev using sudo apt-get install python-dev, and I found out it has been installed already. So I don't know where the problem is.
My default python version is 3.8.16
Could anyone help me with this issue?
maybe conda could install it?
conda install -c anaconda numpy
it isn't generally ideal to mix conda and pip, but it should still install numpy successfully.
Run pip3 install --upgrade pip and try again.
If it doesn't work, try sudo apt-get install pypy-dev instead of python-dev.
You can also try sudo apt-get install python3-numpy
I downloaded pip and ran python setup.py install and everything worked just fine. The very next step in the tutorial is to run pip install <lib you want> but before it even tries to find anything online I get an error "bash: pip: command not found".
This is on Mac OS X. I'm assuming there's some kind of path setting that was not set correctly when I ran setup.py. How can I investigate further? What do I need to check to get a better idea of the exact cause of the problem?
EDIT: I also tried installing Python 2.7 for Mac in the hopes that the friendly install process would do any housekeeping like editing PATH and whatever else needs to happen for everything to work according to the tutorials, but this didn't work. After installing, running 'python' still ran Python 2.6 and PATH was not updated.
Why not just do sudo easy_install pip or if this is for python 2.6 sudo easy_install-2.6 pip?
This installs pip using the default python package installer system and saves you the hassle of manual set-up all at the same time.
This will allow you to then run the pip command for python package installation as it will be installed with the system python. I also recommend once you have pip using the virtualenv package and pattern. :)
2020 Update:
For current Debian/Ubuntu, use
apt-get install python3-pip
to install pip3.
Old 2013 answer (easy_install is now deprecated):
Use setuptools to install pip: sudo easy_install pip
(I know the above part of my answer is redundant with klobucar's, but I can't add comments yet), so here's an answer with a solution to sudo: easy_install: command not found on Debian/Ubuntu: sudo apt-get install python-setuptools
Also, for python3, use easy_install3 and python3-setuptools.
For Python 3, use apt-get install python3-pip.
First of all: try pip3 instead of pip. Example:
pip3 --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
pip3 should be installed automatically together with Python3.x. The documentation hasn't been updated, so simply replace pip by pip3 in the instructions, when installing Flask for example.
Now, if this doesn't work, you might have to install pip separately.
Update: A more reliable modern way to access the right pip install for the right python install is to use the syntax python -m pip.
Original Answer
pip would install itself into the bin of your python installation location. It also should create a symlink to some more common location like /usr/local/bin/pip
You can either edit your ~/.profile and update your PATH to include /Library/Frameworks/Python.framework/Versions/2.6/bin, or you could create a symlink to it in a place that you know is in your path.
If you do: echo $PATH, you should see the paths currently being searched. If /usr/local/bin is in your PATH, you can do:
ln -s /Library/Frameworks/Python.framework/Versions/2.6/bin/pip /usr/local/bin
I would opt for adding the python bin to your $PATH variable.
I encountered this problem having downloaded python 3.x.x and trying to install awscli - pip: command not found.
Whilst following the instructions for downloading the AWS client, I changed
pip install awscli
to
pip3 install awscli
which ran the correct version.
I've made an alias on my machine to run python3 whilst typing python, which would normally run the system version 2.7. I'm not sure this is a good idea now. I think I'll just type in the commands as they intended them to be.
Check out How to Install Pip article for more information.
As of 2019,
Download get-pip.py provided by https://pip.pypa.io using the following command:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run get-pip.py using the following command:
sudo python get-pip.py
After you done installing, run this command to check if pip is installed.
pip --version
Remove get-pip.py file after installing pip.
rm get-pip.py
Install Python latest version as given here
It has many download links like numpy and scipy
Then go to terminal and enter following command:-
sudo easy_install pip
For Python install packages check this
Requirements for Installing Packages
This section describes the steps to follow before installing other Python packages.
Install pip, setuptools, and wheel If you have Python 2 >=2.7.9 or
Python 3 >=3.4 installed from python.org, you will already have pip
and setuptools, but will need to upgrade to the latest version:
On Linux or OS X:
pip install -U pip setuptools On Windows:
python -m pip install -U pip setuptools If you’re using a Python
install on Linux that’s managed by the system package manager (e.g
“yum”, “apt-get” etc…), and you want to use the system package manager
to install or upgrade pip, then see Installing pip/setuptools/wheel
with Linux Package Managers
Otherwise:
Securely Download get-pip.py 1
Run python get-pip.py. 2 This will install or upgrade pip.
Additionally, it will install setuptools and wheel if they’re not
installed already.
I spent ages going through all the answers on this page but found the one that worked for me in the comments of the OP question by s-walsh
The answer is to use pip3:
$ pip3 install <name-of-install>
Installing using apt-get installs a system wide pip, not just a local one for your user. Try this command to get pip running on your system ...
$ sudo apt-get install python-pip python-dev build-essential
Then pip will be installed without any issues and you will be able to use "sudo pip...".
Most of the methods to install PIP are deprecated. Here is the latest (2019) solution. Please download get-pip script
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run the script
sudo python get-pip.py
Latest update 2021.
In Ubuntu 20 64bit works perfectly
Installation of python3
sudo apt install python3
Pip Installation
sudo apt install python3-pip
Add following alias in $HOME/.bash_aliases in some cases file may be hidden.
alias pip="/usr/bin/python3 -m pip "
Refresh current terminal session.
. ~/.profile
check pip usage: pip
Install a package: pip install {{package_name}}
extra info
to get Home path
echo $HOME
you will get your home path.
To solve:
Add this line to ~/.bash_profile:
export PATH="/usr/local/bin:$PATH"
In a terminal window, run
source ~/.bash_profile
It might be the root permission. I tried exit root login, and use
sudo su -l root
pip <command>
install Homebrew, open Terminal or your favorite OSX terminal emulator and run
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your ~/.profile file
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Now, we can install Python 2.7:
$ brew install python
Get pip repository:
$ git clone https://github.com/pypa/pip
install pip:
$sudo easy_install pip
python install it by default but if not install you can install it manual use following cmd (for linux only )
for python3 :
sudo apt install python3-pip
for python2
sudo apt install python-pip
hope its help.
If you are running Python 3.5, run the following terminal command:
sudo pip3 install -U nltk
Any other pip commands in terminal would be similar:
pip3 install --upgrade pip
sudo pip3 install -U numpy ::
It solved my problem by using
sudo easy_install pip
Solved this by upgrading python 3 brew upgrade python:
Now i can just do:
pip3 install <package>
==> python
Python has been installed as
/usr/local/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have
Based on this stackoverflow answer and some of the answers on this thread, I have created an alias in the rc file:
alias pip="python3 -m pip"
There seem to be many different answers to this question but this seems to be the best-practice approach.
Avoiding sudo:
python <(curl https://bootstrap.pypa.io/get-pip.py) --user
echo 'export "PATH=$HOME/Library/Python/2.7/bin:$PATH"' >> ~/.bash_profile
From:
http://www.pip-command-not-found.com
CentOS 7 users can just use:
yum install python-pip
Also recommend using virtualenv if you're using pip. It can be added in the same way:
yum install python-virtualenv
assuming you have internet see:
https://pip.pypa.io/en/stable/installing/
basically run:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
and
python get-pip.py
Try using this. Instead of zmq, we can use any package instead of zmq.
sudo apt-get install python3-pip
sudo apt-get update
python3 -m pip install zmq
I was was not able to install this zmq package in my docker image because of the same issue i was getting. So tried this as another way to install and it worked fine for me.
To overcome the issue bash: pip: command not found in Mac
Found two versions on Mac 1 is 2.7 and the other is 3.7
when I say sudo easy_install pip, pip got installed under 2.7
when I say sudo easy_install-3.7 pip, pip got installed under 3.7
But, whenever I would require to do pip install , I wanted to install the package under python3.7, so I have set an alias (alias pip=pip3) in .bash_profile.
so now, whenever I do pip install <package_name>, it gets installed under python3.7
(Context: My OS is Amazon linux using AWS. It seems similar to RedHat but it's stripped down a bit, it seems.)
Exit the shell, then open a new shell. The pip command now works.
That's what solved the problem at this location.
You might want to know as well: The pip commands to install software then needed to be written like this example (jupyter for example) to work correctly on my system:
pip install jupyter --user
Specifically, note the lack of sudo, and the presence of --user
Would be real nice if pip docs had said anything about all this, but that would take typing in more characters I guess.
Not sure why this wasnt mentioned before, but the only thing that worked for me (on my NVIDIA Xavier) was:
sudo apt-get install python3-pip
(or sudo apt-get install python-pip for python 2)
apt -y -qq install python3 python3-pip
ln -s /usr/bin/python3 /usr/bin/python
ln -s /usr/bin/pip3 /usr/bin/pip
What I did to overcome this was sudo apt install python-pip.
It turned out my virtual machine did not have pip installed yet. It's conceivable that other people could have this scenario too.
The updated command for installing pip3 is :
sudo apt-get install python3-pip
The problem seems that your python version and the library yoıu want to install is not matching versionally. Ex: If Django is Django3 and your python version is 2.7, you may get this error.
"After installing is running 'python' still ran Python 2.6 and PATH was not updated."
1- Install latest version of Python
2- Change your PATH manually as python38 and compare them.
3- Try to reinstall.
I solved this problem as replacing PATH manually with the latest version of Python.
As for Windows: ;C:\python38\Scripts
I am trying to use the qrtools module with Python 3.4.2 on my Raspberry Pi 2, however it cannot run as I don't have the zbar module installed.
Trying
pip-3.2 install zbar
Gives the error message shown in the picture
sudo pip-3.2 install zbar
gives a similar error
Any ideas?
(I do have it installed with Python 2.7)
UPDATE: Both libzbar-dev and python3-dev are up to date. Still...
No module named 'zbar'
assuming you're using a debian derivative (like ubuntu), you need to install zbar's developement package, which contains the header file zbar.h
$ sudo apt-get install libzbar-dev
for redhat/fedora systems:
$ sudo yum install zbar-devel
and probably python's dev package too:
$ sudo apt-get install python3-dev
or you can use pip install zbar-py
https://pypi.org/project/zbar-py/
Try the following code after entering sudo mode:
yum install zbar-devel
This should work for fedora.
Bumping #herve solution
On ubuntu and on Mint
sudo apt-get install python-zbar libzbar-dev python-qrtools
pip install libzbar-cffi==0.2.1