Python包管理:pip、easy_install、eggs和wheel

本文介绍了Python的包管理工具pip、easy_install以及两种包格式Eggs和Wheel。pip作为easy_install的升级版,支持通过requirements.txt管理和直接安装压缩包。easy_install可以从URL或.egg文件安装包。Eggs是setuptools引入的安装格式,而Wheel是更现代的zip包格式,提升了安装效率,成为发布模块的推荐格式。

1. pip

pip 是一个安装和管理 Python 包的工具 , 是 easy_install 的一个替换品。

distribute是setuptools的取代(Setuptools包后期不再维护了)。

pip的安装需要setuptools 或者 distribute,如果你使用的是Python3.x那么就只能使用distribute因为Python3.x不支持setuptools。

pip 可以利用 requirments.txt 来实现在依赖的安装。在 setup.py 中,也存在一个install_requires 表来指定依赖的安装。它们的区别在哪里?可以看这篇文章: setup.py vs requirements.txt (中文版)

D:\UserData\Downloads>easy_install pysqlcipher3-1.0.3-py3.7-win32.egg WARNING: The easy_install command is deprecated and will be removed in a future version. Processing pysqlcipher3-1.0.3-py3.7-win32.egg creating c:\users\admin\appdata\local\programs\python\python39\lib\site-packages\pysqlcipher3-1.0.3-py3.7-win32.egg Extracting pysqlcipher3-1.0.3-py3.7-win32.egg to c:\users\admin\appdata\local\programs\python\python39\lib\site-packages Removing pysqlcipher3 1.0.3 from easy-install.pth file Adding pysqlcipher3 1.0.3 to easy-install.pth file Installed c:\users\admin\appdata\local\programs\python\python39\lib\site-packages\pysqlcipher3-1.0.3-py3.7-win32.egg Processing dependencies for pysqlcipher3==1.0.3 Searching for pysqlcipher3==1.0.3 Reading http://rdsource.tp-link.com/pypi/simple/pysqlcipher3/ Downloading http://rdsource.tp-link.com/pypi/packages/pysqlcipher3/1.0.3/pysqlcipher3-1.0.3.tar.gz#sha256=694e5bbb6ece8a064bd55f261e54b9ffbb3af1784afdc4dce4948a0251a8a430 Best match: pysqlcipher3 1.0.3 Processing pysqlcipher3-1.0.3.tar.gz Writing C:\Users\admin\AppData\Local\Temp\easy_install-0hlokiqt\pysqlcipher3-1.0.3\setup.cfg Running pysqlcipher3-1.0.3\setup.py -q bdist_egg --dist-dir C:\Users\admin\AppData\Local\Temp\easy_install-0hlokiqt\pysqlcipher3-1.0.3\egg-dist-tmp-wzot1opu warning: no previously-included files matching '*~' found anywhere in distribution warning: no previously-included files matching '*.pyc' found anywhere in distribution No eggs found in C:\Users\admin\AppData\Local\Temp\easy_install-0hlokiqt\pysqlcipher3-1.0.3\egg-dist-tmp-wzot1opu (setup script problem?) error: The 'pysqlcipher3==1.0.3' distribution was not found and is required by the application
08-09
python setup.py install Traceback (most recent call last): File "setup.py", line 47, in <module> zip_safe=False, File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 128, in setup _install_setup_requires(attrs) File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 123, in _install_setup_requires dist.fetch_build_eggs(dist.setup_requires) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 513, in fetch_build_eggs replace_conflicting=True, File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 774, in resolve replace_conflicting=replace_conflicting File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1057, in best_match return self.obtain(req, installer) File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1069, in obtain return installer(requirement) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 580, in fetch_build_egg return cmd.easy_install(req) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 698, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 724, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 895, in install_eggs os.path.abspath(dist_filename) distutils.errors.DistutilsError: Couldn't find a setup script in /tmp/easy_install-WPvpqS/pytest-runner-6.0.1.tar.gz
07-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值