Tips for using Python (1) - Installation of third-party function libraries

I guess when you are learning Python, you may occasionally find that the function library you want to install cannot be installed~ Hehehe. Here are some convenient installation methods for you. If one method cannot be installed, other methods can be used. Prevent your mood from being affected by this step during the learning process~

Method 1. Command prompt window installation

(1) Enter " cmd " in the run bar to open the command prompt interface;

(2) Enter " pip install numpy " in the window to install the numpy function library. In the same way, numpy can be replaced with other function library names.

Note: This method may fail to install successfully due to network speed and other issues, which will make you very angry - -

Method 2. Installation in Pycharm

(1) Click " File " in the toolbar and select the " setting " item;

(2) After opening, select the " project " item. Because I have been practicing crawling recently ( for convenience, I just built a crawler project called pachong - -), so the interface is project pachong.

(3) Click the " + " sign below, open it and enter the function library you want to install. In this example, continue with numpy~

(4) Click " Install Package " below to install the corresponding function library ( this method downloads the image file on Douban or Tsinghua University. The network speed is faster and the installation success rate is high. It is recommended~ )

Method 3. Pycharm quick installation

这个方法是在使用Pycharm时,突然发现的方法(当时被自己聪明哭了- -,其实很简单!)。

(1) 在导入包(函数库)的时候,如果该函数库没有安装,会在函数库名下面出现红色波浪线,如下所示:

(2) 这时,将鼠标放到该函数库名称上,会出现如下的提示:

(3) 可以看到,”Install package numpy“后面写着”Alt+Shift+Enter“的快捷键操作,只需要按照要求同时按住”Alt+Shift+Enter“即可快捷安装;或者按住“Alt+Enter”,进行其他更多的操作,如下:

除了“Install package numpy”外,还有其他多个操作,这里就暂时不提及啦。大家平时也可以多试用这个功能,有时会帮大忙呢~

好了,以上就是Python第三方函数库安装的小Tip啦,之前也尝试过下载文件放入文件夹等方式。但是通常情况下,这几种方法都可以比较方便地导入。

如果大家还有一些其他的方式,可以留下来哈!!到时候方便大家一起回来查阅!!


参考链接

https://zhuanlan.zhihu.com/p/364898957

Guess you like

Origin blog.csdn.net/qq_41958946/article/details/128848570