当我从git repo安装“pip install -e ...”时,我必须指定#egg = somename或pip抱怨。例如:
pip install -e git://github.com/hiidef/oauth2app.git#egg=oauth2app
这个“蛋”字符串有什么意义?
答案 0 :(得分:27)
每个pip install -h“egg”字符串是作为安装的一部分签出的目录
答案 1 :(得分:7)
您必须包含#egg = Package,因此pip知道该URL的内容。见https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support
答案 2 :(得分:3)
https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support说:
url后缀“egg = - ”的“项目名称”组件由pip在其依赖逻辑中用于标识 在pip下载和分析元数据之前的项目。该 蛋名称的可选“版本”组件不是功能性的 重要。它只是提供了一个关于什么版本的人类可读线索 正在使用中。对于setup.py不在项目根目录中的项目, 使用“子目录”组件。 “子目录”组件的值 应该是从项目的根目录到setup.py的路径 位于。
由此我推断egg值仅用于依赖性检查,因此我认为,按照惯例,应该使用包名称(即some-pypi-package-name
),而不是任何包含的文件夹(即{{1} })
答案 3 :(得分:1)
一个鸡蛋就是some bundled python code。在git网址中,egg是项目名称。 VCS Support
通常,我们从Pypi安装python软件包,因此您仅指定软件包名称和版本(如果未指定,则假定为最新版本)。然后,Pypi搜索您想要的鸡蛋,然后pip安装该鸡蛋。 Traceback (most recent call last):
File "test6.py", line 93, in <module>
x_attended = Attendancetable.create(classid = 'IT_20141', date = str(datetime.now()).split(' ')[0] + times, userid = x)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 5580, in create
inst.save(force_insert=True)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 5727, in save
pk_from_cursor = self.insert(**field_dict).execute()
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 1622, in inner
return method(self, database, *args, **kwargs)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 1693, in execute
return self._execute(database)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2355, in _execute
return super(Insert, self)._execute(database)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2118, in _execute
cursor = database.execute(self)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2724, in execute
return self.execute_sql(sql, params, commit=commit)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2718, in execute_sql
self.commit()
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2509, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2711, in execute_sql
cursor.execute(sql, params or ())
File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
peewee.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`AAS`.`attendanceTable`, CONSTRAINT `fk_attendanceTable_1` FOREIGN KEY (`UserId`) REFERENCES `userTable` (`userid`))')
Traceback (most recent call last):
File "test6.py", line 93, in <module>
x_attended = Attendancetable.create(classid = 'IT_20141', date = str(datetime.now()).split(' ')[0] + times, userid = x)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 5580, in create
inst.save(force_insert=True)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 5727, in save
pk_from_cursor = self.insert(**field_dict).execute()
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 1622, in inner
return method(self, database, *args, **kwargs)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 1693, in execute
return self._execute(database)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2355, in _execute
return super(Insert, self)._execute(database)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2118, in _execute
cursor = database.execute(self)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2724, in execute
return self.execute_sql(sql, params, commit=commit)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2718, in execute_sql
self.commit()
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2509, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/home/user/.local/lib/python2.7/site-packages/peewee.py", line 2711, in execute_sql
cursor.execute(sql, params or ())
File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
peewee.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`AAS`.`attendanceTable`, CONSTRAINT `fk_attendanceTable_1` FOREIGN KEY (`UserId`) REFERENCES `userTable` (`userid`))')
将安装最新发布的egg,而pip install celery
将安装一个包含相同celery软件包的不同鸡蛋,并从celery的setup.py中列出为Redis依赖项的所有软件包中安装最新的egg。
使用git和gitlab路径,您可以指定pip install celery[redis]
。 /{user|group}/{repository}.git@{tag}#egg={package-name}
和#egg=celery
之间是有区别的,但是它们都来自相同的源代码。
“标签”除实际标签外,还可以是分支或提交哈希。如果未指定,则假定为#egg=celery[redis]
。
例如,master
将检出master分支并进行安装。即使您指定了版本号,在安装中也不会考虑。 版本号被忽略
通过git或其他VCS网址进行安装时,您将需要查找所需版本的标签或哈希。例如,git+https://github.com/celery/celery.git#egg=celery==4.3.0
将检出标记为“ v4.3.0”的提交,然后从该源代码安装该软件包。假设维护人员没有过分地错误标记他们的存储库,则可以得到所需的版本。