Pip Update 명령어 - Pip Update myeonglyeong-eo

PIP는 Pythond의 Package 관리자이다. 개발언어인 파이선에서 패키지는 라이브러리 개념과 동일하다. PIP를 통한 패키지를 관리하기 위한 명령을 정리한다.

# pip 업데이트 (Linux)

pip install pip --upgrade

# pip 업데이트 (Windows)

python -m pip install --upgrade pip

# Python 설치(opencv-contrib-python 패키지)

pip install opencv-contrib-python

# Update 해야할 패키지 목록

pip list -o

# numpy 패키지 설치

pip install numpy

# numpy 패키지 업데이트

pip install numpy --upgrade

# numpy 패키지 제거

pip uninstall numpy

# 특정 버전의 (또는 contrib 버전) opencv 패키지 설치(참조 url: //pypi.org/project/opencv-contrib-python/3.4.5.20/)

pip install opencv-contrib-python==3.4.5.20

Python pip Upgrade 방법 (How To Upgrade pip in Mac, Windows, Linux)

Python패키지 관리 시스템pip업그레이드 하는 방법을 알려드리도록 하겠습니다.

현재 pip version 확인 방법

pip --version pip -V

위 명령어를 사용하여 현재 설치되어 있는 pip 의 버전을 확인할 수 있습니다.

pip Upgrade 방법

Mac, Windows 환경

python -m pip install --upgrade pip

맥 혹은 윈도우 환경이시라면,

위 명령어를 사용하여 pip 를 Upgrade 할 수 있습니다.

Linux 환경

pip install --upgrade pip

리눅스 환경이시라면,

위 명령어를 사용하여 pip 를 Upgrade 할 수 있습니다.

다시 pip --version 혹은 pip -V 명령어로 pip의 버전을 확인해보면 업그레이드 된 것을 확인하실 수 있습니다.

이상으로 pip Upgrade 하는 방법에 대한 설명을 마치도록 하겠습니다.

도움이 되셨다면 공감, 댓글 부탁드립니다!

궁금하신 점이나 요청사항은 언제든지 말씀해주세요!

피드백도 언제나 환영입니다!

감사합니다.

I'm able to update pip-managed packages, but how do I update pip itself? According to pip --version, I currently have pip 1.1 installed in my virtualenv and I want to update to the latest version.

What's the command for that? Do I need to use distribute or is there a native pip or virtualenv command? I've already tried pip update and pip update pip with no success.

Falko

16.5k13 gold badges54 silver badges102 bronze badges

asked Mar 5, 2013 at 10:29

zakdanceszakdances

20.6k32 gold badges100 silver badges168 bronze badges

4

pip is just a PyPI package like any other; you could use it to upgrade itself the same way you would upgrade any package:

pip install --upgrade pip

On Windows the recommended command is:

python -m pip install --upgrade pip

sourcenouveau

28.4k34 gold badges143 silver badges240 bronze badges

answered Mar 5, 2013 at 12:03

13

The more safe method is to run pip though a python module:

python -m pip install -U pip

On windows there seem to be a problem with binaries that try to replace themselves, this method works around that limitation.

answered Mar 1, 2016 at 16:00

Janusz SkoniecznyJanusz Skonieczny

16.4k10 gold badges53 silver badges63 bronze badges

4

In my case my pip version was broken so the update by itself would not work.

Fix:

(inside virtualenv):easy_install -U pip

answered Jun 28, 2017 at 17:31

jmozjmoz

7,6915 gold badges30 silver badges33 bronze badges

5

I tried all of these solutions mentioned above under Debian Jessie. They don't work, because it just takes the latest version compile by the debian package manager which is 1.5.6 which equates to version 6.0.x. Some packages that use pip as prerequisites will not work as a results, such as spaCy (which needs the option --no-cache-dir to function correctly).

So the actual best way to solve these problems is to run get-pip.py downloaded using wget, from the website or using curl as follows:

wget //bootstrap.pypa.io/get-pip.py -O ./get-pip.py python ./get-pip.py python3 ./get-pip.py

This will install the current version which at the time of writing this solution is 9.0.1 which is way beyond what Debian provides.

$ pip --version pip 9.0.1 from /home/myhomedir/myvirtualenvdir/lib/python2.7/dist-packages (python 2.7) $ pip3 --version pip 9.0.1 from /home/myhomedir/myvirtualenvdir/lib/python3.4/site-packages (python 3.4)

answered Jan 29, 2018 at 14:58

Eamonn KennyEamonn Kenny

1,74116 silver badges19 bronze badges

3

for windows,

  • go to command prompt
  • and use this command
  • python -m pip install -–upgrade pip
  • Dont forget to restart the editor,to avoid any error
  • you can check the version of the pip by
  • pip --version
  • if you want to install any particular version of pip , for example version 18.1 then use this command,
  • python -m pip install pip==18.1

answered Dec 1, 2020 at 7:03

Rohan DevakiRohan Devaki

2,5031 gold badge12 silver badges20 bronze badges

0

In case you are using venv any update to pip install will result in upgrading the system pip instead of the venv pip. You need to upgrade the pip bootstrapping packages as well.

python3 -m pip install --upgrade pip setuptools wheel

Neuron

4,6924 gold badges33 silver badges54 bronze badges

answered Apr 1, 2019 at 12:30

dre-hhdre-hh

7,6222 gold badges31 silver badges42 bronze badges

5

pip install --upgrade pip

In UBUNTU 18.04 I got the following error when I execute the above command:

ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/bin/pip' Consider using the `--user` option or check the permissions.

The below command solves my problem:

pip install --upgrade pip --user

Parzival

1,7804 gold badges11 silver badges26 bronze badges

answered Jul 31, 2021 at 19:45

HasinurHasinur

1861 silver badge6 bronze badges

Upgrading pip using 'pip install --upgrade pip' does not always work because of the dreaded cert issue: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version

I like to use the one line command for virtual envs:

curl //bootstrap.pypa.io/get-pip.py | python -

Or if you want to install it box wide you will need

curl //bootstrap.pypa.io/get-pip.py | sudo python -

you can give curl a -s flag if you want to silence the output when running in an automation script.

answered Feb 25, 2019 at 6:41

roublerouble

15.1k16 gold badges102 silver badges98 bronze badges

To get this to work for me I had to drill down in the Python directory using the Python command prompt (on WIN10 from VS CODE). In my case it was in my AppData\Local\Programs\Python\python35-32 directory. From there now I ran the command...

python -m pip install --upgrade pip

This worked and I'm good to go.

Neuron

4,6924 gold badges33 silver badges54 bronze badges

answered Feb 14, 2018 at 13:44

SeanSean

3692 silver badges4 bronze badges

In my case this worked from the terminal command line in Debian Stable

python3 -m pip install --upgrade pip

zx485

27.6k28 gold badges51 silver badges58 bronze badges

answered Jun 20, 2017 at 13:16

Open Command Prompt with Administrator Permissions, and repeat the command:

python -m pip install --upgrade pip

Grant Miller

25.7k16 gold badges140 silver badges157 bronze badges

answered Aug 18, 2018 at 13:37

MRamzanMRamzan

1532 silver badges7 bronze badges

2

pip version 10 has an issue. It will manifest as the error:

ubuntu@mymachine-:~/mydir$ sudo pip install --upgrade pip Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main

The solution is to be in the venv you want to upgrade and then run:

sudo myvenv/bin/pip install --upgrade pip

rather than just

sudo pip install --upgrade pip

answered Sep 5, 2018 at 0:23

CalafCalaf

9,34714 gold badges53 silver badges112 bronze badges

I was in a similar situation and wanted to update urllib3 package. What worked for me was:

pip3 install --upgrade --force-reinstall --ignore-installed urllib3==1.25.3

answered May 27, 2019 at 19:34

For linux

python3 -m pip install --upgrade pip

For windows:

  1. Type Command Prompt in the Windows search box

  2. In the Command Prompt, type cd\

  3. Press Enter, and you’ll see the drive name C:\>

  4. Locate your Python application path, which is the folder where you originally installed Python

    Here is an example of a Python application path:

    C:\Users\Ron\AppData\Local\Programs\Python\Python39
  5. Once you retrieved the Python application path, type the following command in the Command Prompt:

    cd followed by your Python application path

    For our example:

    C:\>cd C:\Users\Ron\AppData\Local\Programs\Python\Python39
  6. Press Enter

  7. Type python -m pip install --upgrade pip and press Enter

Neuron

4,6924 gold badges33 silver badges54 bronze badges

answered Jul 6, 2021 at 12:16

DevDev

3854 silver badges16 bronze badges

On my lap-top with Windows 7 the right way to install latest version of pip is:

python.exe -m pip install --upgrade pip

Stephen Rauch

46k31 gold badges106 silver badges127 bronze badges

answered Aug 7, 2018 at 23:00

MiloshBMiloshB

1251 gold badge2 silver badges10 bronze badges

1

First, do this:

sudo apt install python3-pip python-setuptools-doc

Then, as a non-root user (NEVER, never run pip* as root!):

# N.B. bash shell works for this, I have never tested with other shells! . ....your_virtualenv_folder/bin/activate pip3 install -U pip

Note: -U is a synonym for --upgrade, as far as I know.

Neuron

4,6924 gold badges33 silver badges54 bronze badges

answered Jul 6, 2021 at 11:53

Single Line Python Program
The best way I have found is to write a single line program that downloads and runs the official get-pip script. See below for the code.

The official docs recommend using curl to download the get-pip script, but since I work on windows and don't have curl installed I prefer using python itself to download and run the script.

Here is the single line program that can be run via the command line using Python 3:

python -c "import urllib.request; exec(urllib.request.urlopen('//bootstrap.pypa.io/get-pip.py').read())"

This line gets the official "get-pip.py" script as per the installation notes and executes the script with the "exec" command.

For Python2 you would replace "urllib.request" with "urllib2":

python -c "import urllib2; exec(urllib2.urlopen('//bootstrap.pypa.io/get-pip.py').read())"

Precautions
It's worth noting that running any python script blindly is inherently dangerous. For this reason, the official instructions recommend downloading the script and inspecting it before running.

That said, many people don't actually inspect the code and just run it. This one-line program makes that easier.

answered Sep 21, 2018 at 13:38

FistOfFuryFistOfFury

6,4177 gold badges45 silver badges57 bronze badges

I had a similar problem on a raspberry pi.

The problem was that http requires SSL and so I needed to force it to use https to get around this requirement.

sudo pip install --upgrade pip --index-url=//pypi.python.org/simple

or

sudo pip-3.2 --upgrade pip --index-url=//pypi.python.org/simple/

answered Dec 12, 2018 at 22:11

user391339user391339

7,93713 gold badges53 silver badges71 bronze badges

Head to your command prompt and type the following:

python -m pip install --upgrade pip

answered Jan 6 at 11:37

While updating pip in virtual env use full path in python command

Envirnments folder struture

myenv\scripts\python

h:\folderName\myenv\scripts\python -m pip install --upgrade pip

answered May 6 at 9:05

I had installed Python in C:\Python\Python36 so I went to the Windows command prompt and typed cd C:\Python\Python36 to get to the right directory. Then entered the python -m install --upgrade pip all good!

Neuron

4,6924 gold badges33 silver badges54 bronze badges

answered Mar 25, 2018 at 18:41

Very Simple. Just download pip from //bootstrap.pypa.io/get-pip.py . Save the file in some forlder or dekstop. I saved the file in my D drive.Then from your command prompt navigate to the folder where you have downloaded pip. Then type there

python -get-pip.py

answered Aug 14, 2018 at 4:14

In linux

I will update with this code

sudo -H pip3 install --upgrade pip

answered Feb 5 at 20:18

NetwonsNetwons

85810 silver badges13 bronze badges

Toplist

최신 우편물

태그