How to use pip in Python



Python
library
pip

MeCab

Common
class

pickle

numpy
digitize

linalg.solve

meshgrid

mgrid

pad

poly1d

polyfit

prod

shape

matplotlib
figure

pcolormesh

scatter

pytorch
BCELoss, MSELoss

device

Embedding

TensorDataset, Dataloader

RNN, LSTM
scikit-learn
SVC

GaussianNB

scipy
interpolate
tkinter
postscript

image display

frame, grid

Crop Image

other
linear interpolation

OpenAI gym
CartPole-v0

By purpose
1 of K Coding


Release date:2023/3/27         

 ・In Japanese
<premise knowledge>
 ・Python
 ・Specific example of how to install the library


■Basic command using pip

"pip" has functions for installing/uninstalling libraries in python and checking library information. The basic command to install is below.Run it on the command prompt.

 pip install 'library name'

See here for a specific example of how to install.

■Setting Environment Variables

If you get the following error when installing the library with pip, there may be a problem with the environment variables.

'pip' is not recognized as an internal or external command,operable program or batch file.

If the installation is successful but the following error occurs when importing, the environment variables are not set correctly. (The variable is not set above. The setting location is incorrect below.)

ModuleNotFoundError: No module named 'numpy'

Set the environment variables as follows. Go to [Control panel]→[System]→[System Properties]. Click Environment Variables below.



Activate the user variable Path and click the edit button.



Add the following two paths. (For Python ver3.8)
 \python38
 \python38\Scripts



■Other pip commands

pip list :Prints a list of installed libraries.

pip install 'library name'==1.14.0 :Specify the library version (version 1.14.0 in this case) and install.

pip install --upgrade pip :Update pip to the latest ver.

pip uninstall 'library name' :Uninstall the library.

pip show 'library name' :Check where the library is installed.









List of related articles



Python
library
pip

MeCab

Common
class

pickle

numpy
digitize

linalg.solve

meshgrid

mgrid

pad

poly1d

polyfit

prod

shape

matplotlib
figure

pcolormesh

scatter

pytorch
BCELoss, MSELoss

device

Embedding

TensorDataset, Dataloader

RNN, LSTM
scikit-learn
SVC

GaussianNB

scipy
interpolate
tkinter
postscript

image display

frame, grid

Crop Image

other
linear interpolation

OpenAI gym
CartPole-v0

By purpose
1 of K Coding