To use pip to install Python third-party libraries, please perform the following steps: If pip is not installed, please use the "python3 -m ensurepip --upgrade" command to install it. Use the "pip install
" command to install the library. To install a specific version, specify the version number: "pip install == ". To install a native library, use the "-e" option: "pip install -e ". To uninstall the library, use "pip uninstall
Normally, pip has been automatically installed during Python installation. If pip is not installed, please use the following command:
<code>python3 -m ensurepip --upgrade</code>
Use pip to install third-party libraries, Just enter the following command at the command line:
<code>pip install <库名称></p> <p>For example, to install the NumPy library: </p> <pre class="brush:php;toolbar:false"><code>pip install numpy</code>
To install a specific version of the library, Specify the version number in the command:
<code>pip install <库名称>==<版本号></code>
For example, to install version 1.22.0 of NumPy:
<code>pip install numpy==1.22.0</code>
To install the local library, use -e
Options:
<code>pip install -e <库路径></code>
For example, to install the my_library
library in the current directory:
<code>pip install -e ./my_library</code>
To uninstall the library, Please use the uninstall
command:
<code>pip uninstall <库名称></code>
For example, to uninstall NumPy:
<code>pip uninstall numpy</code>
In addition to pip, there are other libraries Installation method, for example:
Please note that it is recommended to use pip as the main tool for installing Python third-party libraries.
The above is the detailed content of How to download third-party libraries in python. For more information, please follow other related articles on the PHP Chinese website!