TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why do programming languages have their own package managers?

4 点作者 guhsnamih超过 4 年前
With python I have run into issues where I have multiple packages lying around, those installed by the OS&#x27;s package manager and those installed by pip of another python.<p>With node I have always had to install a newer version than that installed by the OS.<p>ROS seems to take this even further. There is a ros-kinetic-<i>, ros-melodic-</i> series of packages each for a specific Ubuntu release.<p>There is also perl&#x27;s CPAN.<p>OCaml had not one but 2 package managers I think and the only package set that seems to work is that is the default OS install. The others apparently stay up to speed with ocaml updates.<p>What are possible solutions&#x2F;workarounds, if at all this is seen as a problem?

1 comment

thesuperbigfrog超过 4 年前
Why do programming languages have their own package managers?<p>To simplify dependency management. Most popular and useful programming languages will have a community that creates useful libraries and frameworks that enable a developer to quickly build a solution to common problems or use cases. In many cases these libraries and frameworks will rely on other, lower-level libraries that provide specific functionality. This quickly results in a dependency tree since version X of the higher-level library or framework depends on version Y of lower-level library A and version Z of lower-level library B. Many programming languages simplify dependency management by allowing the programming to declare a dependency on version X of the higher-level library and the transitive dependencies for lower-level libraries A and B are automatically resolved and downloaded.<p>In the case of python and perl, many operating systems use these scripting languages to power system-level scripts and utilities. This means that parts of operating system are dependent on specific versions of the scripting languages. Historically, that meant that you were stuck with that version of the scripting language and could install packages into the system-wide package directories and use them. Some operating systems (e.g. Debian) include many programming language libraries as <i>operating system</i> packages, effectively bypassing the programming language package management mechanisms. This makes a lot of sense for programming languages that have a strong dependency on the operating system&#x27;s underlying C libraries. Some of the programming languages have version selection mechanisms that let you install multiple versions of the programming language side-by-side.<p>More recently, some operating systems have began to separate the operating system&#x27;s scripting language install from the newer versions of the scripting language that are intended for application development. For example: <a href="https:&#x2F;&#x2F;www.redhat.com&#x2F;en&#x2F;resources&#x2F;red-hat-software-collections?source=searchresultlisting&amp;page=1" rel="nofollow">https:&#x2F;&#x2F;www.redhat.com&#x2F;en&#x2F;resources&#x2F;red-hat-software-collect...</a> This decouples the operating system dependencies from software development tools in an effort to prevent the mess that results from having the operating system and programming environment use the same libraries in an ad-hoc way. See <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;1987&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;1987&#x2F;</a> for a humorous take on the mess that can result if there is not a clean division between operating system scripting language libraries and programming environment language libraries.
评论 #24428843 未加载