You are using pip3 to install flask-script which is associated with python 3.5. However, you are trying to upgrade pip associated with the python 2.7, try running pip3 install --upgrade pip.
It might be a good idea to take some time and read about virtual environments in Python. It isn't a best practice to install all of your packages to the base python installation. This would be a good start: http://docs.python-guide.org/en/latest/dev/virtualenvs/
Answer from JanHak on Stack OverflowYou are using pip3 to install flask-script which is associated with python 3.5. However, you are trying to upgrade pip associated with the python 2.7, try running pip3 install --upgrade pip.
It might be a good idea to take some time and read about virtual environments in Python. It isn't a best practice to install all of your packages to the base python installation. This would be a good start: http://docs.python-guide.org/en/latest/dev/virtualenvs/
To upgrade your pip3, try running:
sudo -H pip3 install --upgrade pip
Your pip may move from /bin to /usr/local/bin
To upgrade pip as well, you can follow it by:
sudo -H pip2 install --upgrade pip
Videos
I usually just run the following commands to upgrade both pip2 (=pip by default) and pip3:
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
You must make sure that you upgrade the version (for Python 2 or 3), which you want to react on the command pip without number, last.
Also please note that this keeps the old packaged versions installed through apt-get or any other package manager, but adds new versions which have nothing to do with the system packages. The pip-installed packages will be preferred, but you should not remove the apt-get-installed ones either, because the package manager can't know that any pip version is installed otherwise.
I think the
pip install --upgrade pip
command does not work properly anymore. The correct command should be:
for Python 3:
python3 -m pip install --upgrade pipfor Python 2:
python2 -m pip install --upgrade pip
P.S. If you want to make sure your other Python packages are also up to date, follow the instructions here.
Here's my number one tip: Do not use sudo with pip. You don't need it.
Instead, use a user-level Python distribution installed via pyenv. That way you don't risk yourself messing around with system-level frameworks (and hence creating a problem removing dependencies etc.).
Install Pyenv
All you have to do is:
- Run the
pyenvinstaller - Follow the instructions
- Install the Python versions you need
- Choose which Python version you want to use for a given directory, or globally
For example, to install 3.7, check which versions are available:
pyenv install -l | grep 3.7
Then run:
pyenv install 3.7.4
Switch to the new version
Now, you can choose your Python version:
pyenv global 3.7.4
This switches your python to point to 3.7.4. If you want the “old” system python, run:
pyenv global system
To check which Python versions are available, run pyenv versions.
Upgrade pip
Once you've switched to a Pyenv version, you can run pip without sudo, and install/upgrade packages easily — without interfering with your system Python:
pyenv global 3.7.4
pip install --upgrade pip
pip install numpy
Do not use apt-get to update pip. The newest version of pip available through apt-get is old.
Quick solution:
As @kenorb is saying in the comments, you can upgrade pip using pip with sudo like this:
sudo pip install --upgrade pip
Proper solution:
Use pyenv - see the answer by @slhck
I have two solutions to your problem
Try using sudo as stated in above answer.
sudo pip3 install --upgrade pip
Try to do fresh reinstall of pip
apt-get remove python3-pip
pip3 install -U pip
NOTE: This can be done for python2x ,by replace pip3 by pip2
Try:
sudo pip3 install --upgrade pip
"Permission denied" errors are usually solved by adding "sudo" to your commands.
(sudo is just a keyword to execute a given command with privileges)
- If you get a "command not found" then you should do the following:
Type Python into your command console, it will tell you which version of Python you are using.
C:/>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
If you have Python 3.x you should use pip3, if you have Python 2.x you should use pip.
If you are using the right pip but still get the "command not found" then you have to install pip:
For Python2.x:
sudo apt-get install python-pip
For Python 3.x:
sudo apt-get install python3-pip