Home > Backend Development > Python Tutorial > Where is the python third-party library installed?

Where is the python third-party library installed?

爱喝马黛茶的安东尼
Release: 2019-06-20 10:14:24
Original
7488 people have browsed it

Simply put

If it is the python that comes with the system, the dist-packages directory will be used;

If you install python manually, it will use the directory directly site-packages.

This allows you to keep the two installations isolated.

Where is the python third-party library installed?

dist-packages: python that comes with the system

site-packages: python installed by yourself

The installation path of the Python package is as follows

1. The system comes with python

The system comes with a software manager for installation. The module will Installed into dist-packages

Related recommendations: "python video tutorial"

/usr/lib/python2.7/dist-packages/
Copy after login

From easy_install and pip (Note: It is the software manager of python, python has many Many software), they also use dist-packages, but the path is:

/usr/local/lib/python2.7/dist-packages/
Copy after login

2. Install it yourself or upgrade python

python to install a third party The path of the library is:

/usr/lib/python2.7/site-packages/
Copy after login

The installation path of the third-party library installed from easy_install and pip is:

/usr/local/lib/python2.7/site-packages/
Copy after login

3. For non-root users, install the third-party library from easy_install and pip. The installation path is

~/.local/lib/python2.7/site-packages
Copy after login

Sometimes you need to check whether the path of the third-party library is there (the author encountered a pit here. There is a certain library under the normal path, but the import cannot be found and can only point to The corresponding library here)

~/.local/lib/python2.7/site-packages/external/protobuf/python
Copy after login

The above is the detailed content of Where is the python third-party library installed?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template