Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use pip in Python

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge points about how to install and use pip in Python. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

1. Pip online installation

In the cmd command line mode, install the third-party library directly in the form of the name of the pip install third-party library.

Let's take the installation of plotly as an example, and the installation is as follows:

Pip install plotly

If the third-party library that needs to be installed already exists, we will prompt for its existence and show the location of the library installation when we execute the installation command, as shown below:

If you want to uninstall third-party libraries, you can uninstall third-party libraries directly in the form of the name of the pip uninstall third-party library.

Of course, you may encounter a lot of other problems in the actual installation process, including the following two situations:

Installation timeout (because online installation, the source where the third-party library is located will be requested, the default source is overseas, and our request may be too slow to cause a timeout, etc.)

Version number mismatch (because there may be some other libraries in our python environment, and there may be dependencies between libraries, if the installed version of the library is too new or too old, it may not match the existing library and cannot be installed normally)

In the case of installation timeout, if we continue to use the online installation mode of pip, we can specify the domestic source at the time of installation. The instructions are as follows:

Pip install plotly-I https://pypi.tuna.tsinghua.edu.cn/simple

If the version number does not match, we can specify the version number at the time of installation if we continue to use the online installation mode of pip. The instructions are as follows:

Pip install plotly==4.9

There are several ways to specify a version number:

If not specified, the latest is installed by default

= = specify a specific version number

= specify the minimum version number

< 不高于某版本号 >

No less than a certain version number

For cases where a specific version number is not specified, it is important to note that the form of the command is slightly different: the relationship between the third-party library and the version number needs to be in quotation marks ("), otherwise an error will occur.

Pip install "plotly

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report