Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

python的包管理器[0]

Posted on 2023年11月14日2025年5月6日 by

python的软件包管理器如同linux的发行版一样,不同的组合和不同的用户群体和打包方式会有不同的分支结构。

 

  • Anaconda

Anaconda是一个包含180+的科学包及其依赖项的发行版本。其包含的科学包包括:conda, numpy, scipy, ipython notebook等

  • conda

conda是包及其依赖项和环境的管理工具。

适用语言:Python, R, Ruby, Lua, Scala, Java, JavaScript, C/C++, FORTRAN。

用途:快速安装、运行和升级包及其依赖项。
在计算机中便捷地创建、保存、加载和切换环境。
如果你需要的包要求不同版本的Python,你无需切换到不同的环境,因为conda同样是一个环境管理器。仅需要几条命令,你可以创建一个完全独立的环境来运行不同的Python版本,同时继续在你常规的环境中使用你常用的Python版本。conda为Python项目而创造,但可适用于上述的多种语言。conda包和环境管理器包含于Anaconda的所有版本当中。

 

  • pip

pip是用于安装和管理软件包的包管理器。

pip编写语言:Python。

Python中默认安装的版本:

Python 2.7.9及后续版本:默认安装,命令为pip
Python 3.4及后续版本:默认安装,命令为pip3
pip名称的由来:pip采用的是递归缩写进行命名的。其名字被普遍认为来源于2处:

“Pip installs Packages”(“pip安装包”)
“Pip installs Python”(“pip安装Python”)

 

  • virtualenv

virtualenv:用于创建一个独立的Python环境的工具。

解决问题:

当一个程序需要使用Python 2.7版本,而另一个程序需要使用Python 3.6版本,如何同时使用这两个程序?

如果将所有程序都安装在系统下的默认路径,如:/usr/lib/python2.7/site-packages,当不小心升级了本不该升级的程序时,将会对其他的程序造成影响。

如果想要安装程序并在程序运行时对其库或库的版本进行修改,都会导致程序的中断。

在共享主机时,无法在全局site-packages目录中安装包。

virtualenv将会为它自己的安装目录创建一个环境,这并不与其他virtualenv环境共享库;同时也可以选择性地不连接已安装的全局库。

 

参考资料:

  1. https://www.jianshu.com/p/62f155eb6ac5

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT