If you use the pip command as it is like pip list
, the following warning will be displayed and you will be surprised. This way of writing seems to be old.
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
It is recommended to use the pip that comes with Python as follows.
$ python3 -m pip [pip command]
Using the pip that comes with Python doesn't change anything, but I'll post a snippet of my favorite pip command.
$ python3 -m pip list
$ python3 -m pip install [package name]
$ python3 -m pip install [package name]==Specified version
$ python3 -m pip install opencv-python==3.4
However, there is no version called 3.4, so it will tell you which version you can specify carefully.
ERROR: Could not find a version that satisfies the requirement
opencv-python==3.4.10.35 (from versions:
3.2.0.6, 3.2.0.7, 3.2.0.8, 3.3.0.9, 3.3.0.10, 3.3.1.11,
3.4.0.12, 3.4.0.13, 3.4.0.14, 3.4.1.15, 3.4.2.16, 3.4.2.17,
3.4.3.18, 3.4.4.19, 3.4.6.27, 3.4.7.28, 4.0.1.24, 4.1.0.25, 4.1.1.26)
ERROR: No matching distribution found for opencv-python==3.4
I am very grateful.
$ python3 -m pip install [package name]==Specified version
Just like a new installation, you can just run install.
Installing collected packages: opencv-python
Attempting uninstall: opencv-python
Found existing installation: opencv-python 4.1.1.26
Uninstalling opencv-python-4.1.1.26:
Successfully uninstalled opencv-python-4.1.1.26
Successfully installed opencv-python-3.4.7.28
Those installed in this way will be automatically uninstalled.
Basically, there is no problem if you remember "** $ python3 -m pip **". Note that Python comes with pip since version 3.4.
Recommended Posts