对于python的egg安装的理解

xiaoxiao2021-02-27  368

由于ceph需要安装ceph-disk和ceph-detect-init两个egg,今天把python egg的安装方法研究了一下。

官网参考地址

https://pip.pypa.io/en/stable/installing/#id8

get-pip.py获取

wget https://bootstrap.pypa.io/get-pip.py 

pip安装

python get-pip.py

pip会安装到下面路径

/usr/local/lib/python2.7/dist-packages

到这步,还不能pip命令还需要使用apt-get命令安装python-pip

The program 'pip' is currently not installed. You can install it by typing:

sudo apt install python-pip

关于python egg的安装

安装pip之后,已经默认安装了setuptools

easy_install xxxx.egg

ceph-detect-init运行

mac@ubuntu:~/udev$ ceph-detect-init  systemd

egg安装的理解

python-pip负责安装可执行文件,可执行文件调用/usr/local/lib/python2.7/dist-packages/下的pip相关packages,就可以完整使用pip命令

egg安装实际是由easy_install来完成的,pip安装时默认会安装setuptools(easy_install)

其他

使用easy_install安装egg后,如果卸载setuptools,安装好的egg也不能使用了,错误如下:

Traceback (most recent call last):   File "/usr/local/bin/ceph-detect-init", line 6, in <module>     from pkg_resources import load_entry_point ImportError: No module named pkg_resources

转载请注明原文地址: https://www.6miu.com/read-1724.html

最新回复(0)