当前位置:网站首页>Detailed explanation of the different usage of PIP and PIP3

Detailed explanation of the different usage of PIP and PIP3

2022-07-19 09:33:00 One of IT guys

python It is divided python2 and python3 Two versions of , Again pip It's also a point pip and pip3 Of .

There are multiple versions of the computer at the same time python when ,pip3 It can be used for automatic identification python3 To install Libraries , To avoid the same python2 conflict

If your computer only has python3, Use pip perhaps pip3 It's the same

The main differences are as follows :

  • pip yes python Package management tools ,pip and pip3 Different versions , All in Scripts\ Under the table of contents
  • If in the system Install only 了 Python2, Then you can only use pip
  • If only Installed Python3, So you can use pip You can also use pip3, The two are equivalent
  • If in the system At the same time to install 了 Python2 and Python3, be pip By default Python2 use ,pip3 Assign to Python3 use
  • stay A virtual environment in , If there is only one python edition , It can be considered that in the system in use pip and pip3 The commands are the same

Installation and use differences :

pip install xxxxxx
The newly installed library will be placed under this directory :python2.x/site-packages

see python in pip Where the installation package is located :

  • Use pip list View installed package names
  • And then use pip show Package name , You can see where it is installed

Be careful : Usually installed in python Install under directory lib/site-packages Under the table of contents !

pip show  Package name 

  Be careful : If you use python  Execution procedure , Then we can't  import python3.x/site-packages  Library in .

pip3 install xxxxxx
The newly installed library will be placed under this directory :python3.x/site-packages

 

see python3 in pip3 Where the installation package is located :

  • Use pip3 list View installed package names
  • And then use pip3 show Package name , You can see where it is installed

Be careful : Usually installed in python Install under directory lib/site-packages Under the table of contents !

  Be careful : If you use python3 Execution procedure , Then we can't  import python2.x/site-packages  Library in .

原网站

版权声明
本文为[One of IT guys]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207171022412891.html