pip is the package installer for Python. It is similar to gem of Ruby and npm or yarn of Nodejs.
If Python 2.x and 3.x are installed together, it can be used like pip3 to distinguish the version.
pip is contained in Python.
Usage
Self Upgrade
- On MAC / Linux
$ pip install -U pip
- On Windows
$ python -m pip install -U pip
Check Packages are Installed
$ python -c 'import <package names>'
Install Latest Version of Packages
$ pip install <package names>
Install Specific Version of Packages
$ pip install <package name==version>
$ pip install <package name>=minimum_version>
Depending on your environment, you may need '(single quote). It prevents the > symbol from working as a redirection in the shell.
Install Packages Specified in File
$ pip install -r requirements.txt
requirements.txt is not a mandatory name, but it is a conventionally used name, so you have to follow if there is no particular reason.
The file specifies the name of the packages you want to install, one per line.
Show All Installed Packages
$ pip list
Show Information of the Specified Packages
$ pip show <package names>
You can also see the dependencies of the specified packages.
Freeze All Installed Packages to the File
$ pip freeze > requirements.txt
requirements.txt is not a mandatory name, but it is a conventionally used name, so you have to follow if there is no particular reason.
This command freezes all installed packages with the installed version.
'Python' 카테고리의 다른 글
[Python] Beautiful Soup4 module (0) | 2020.10.09 |
---|---|
[Python] requests module (0) | 2020.10.08 |
[Python] Abstract Class (0) | 2020.09.28 |
[Python] venv (0) | 2020.08.29 |
[Python] pyenv (0) | 2020.08.29 |
댓글