0

I'm experiencing a issue with my packages, I installed a package with Python 3.7 and the current version of Python in my computer is 3.9. So I can't uninstall or update the given package.

ζ pip3 install --upgrade youtube-dl
Requirement already satisfied: youtube-dl in /usr/local/lib/python3.9/site-packages (2021.4.7)
Collecting youtube-dl
  Downloading youtube_dl-2021.4.26-py2.py3-none-any.whl (1.9 MB)
     |████████████████████████████████| 1.9 MB 551 kB/s
Installing collected packages: youtube-dl
  Attempting uninstall: youtube-dl
    Found existing installation: youtube-dl 2021.4.7
    Uninstalling youtube-dl-2021.4.7:
      Successfully uninstalled youtube-dl-2021.4.7
Successfully installed youtube-dl-2021.4.26
WARNING: You are using pip version 21.0.1; however, version 21.1.1 is available.
You should consider upgrading via the '/usr/local/opt/python@3.9/bin/python3.9 -m pip install --upgrade pip' command.

ζ youtube-dl --version
2021.04.01

ζ which pip3
/usr/local/opt/python@3.9/bin/pip3

ζ which youtube-dl
/Library/Frameworks/Python.framework/Versions/3.7/bin/youtube-dl

How can

Antonio
  • 2,848
  • 2
  • 15
  • 15
  • The real problem here is that `/Library/Frameworks/Python.framework/Versions/3.7/bin` appears in your PATH before the location where the other `youtube-dl` binary was stored... Which you can install with brew, so not sure why you'd want to use pip – OneCricketeer May 09 '21 at 13:37

2 Answers2

0

What you need to do to solve this issue is navigate to the Pip from the version that you have installed the package, in this case, 3.7, uninstall or update the package using this pip.

ζ cd /Library/Frameworks/Python.framework/Versions/3.7/bin/
ζ ./pip3 uninstall youtube-dl
Found existing installation: youtube-dl 2021.4.1
Uninstalling youtube-dl-2021.4.1:
  Would remove:
    /Library/Frameworks/Python.framework/Versions/3.7/bin/youtube-dl
    /Library/Frameworks/Python.framework/Versions/3.7/etc/bash_completion.d/youtube-dl.bash-completion
    /Library/Frameworks/Python.framework/Versions/3.7/etc/fish/completions/youtube-dl.fish
    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/youtube_dl-2021.4.1.dist-info/*
    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/youtube_dl/*
    /Library/Frameworks/Python.framework/Versions/3.7/share/doc/youtube_dl/README.txt
    /Library/Frameworks/Python.framework/Versions/3.7/share/man/man1/youtube-dl.1
Proceed (y/n)? y
  Successfully uninstalled youtube-dl-2021.4.1

Now you can install the package with latest the Python in your system

ζ pip3 install youtube-dl

This answer also provide a method for dealing with multiple python versions

Antonio
  • 2,848
  • 2
  • 15
  • 15
-2

well and if you are looking to install the latest pip version with the help of pip, just runpython3 -m pip install pip=="VERSION_NUMBER_HERE" for a precise pip installation

Phil
  • 9
  • 1
  • 6