Python package management in Mac OS X

2019-08-31 06:45发布

问题:

Every time I tried to install a new package for python on Mac OS X, I had this issue which these packages had different ways to setup with different package management tools. Specially for new versions of Mac OS X 10.9 Mavericks, some of installers are buggy, then I needed to switch between them. I'm asking for a short description and comparison between these main command-line installers: easy_install, pip, port, apt-get, brew, fink, and etc. Of course, sometimes there is no way other than installing through source code make install, python setup.py, or .pkg installer files. But I guess that's not the case when you need to install more complicated packages with lots of dependencies.

What I'm asking has two sides:

  1. Is it safe to use them side by side? or are there any known conflicts between these command-line tools? (at least brew throws warnings on port availability)
  2. Is there any known cons and pros based on nature of these package managements, in case when we had choice between them?

回答1:

  1. pip and easy_install are for python libraries.
  2. apt-get, brew, fink, port, etc. These tools are 'distro style' package management tools.

They have one area of overlap in terms of 'why do i need one of each?' and that is Library dependencies.

pip is the tool endorsed by the most python developers and the python packaging SIG going forward, so TLDR; use pip not easy_install

these tools also work with virtualenvs and virtualenvs are great. use them :)

You will however run into occasions where you need other libraries that python doesnt quite know what to do with when you try and build a python package with pip. It is these moments that make it necessary to have one of the other tools.