Explanation: Python's stack-limit is a safety-belt against endless recursion, eating up memory. PyInstaller imports modules recursively. If the structure how modules are imported within your program is awkward, this leads to the nesting being too deep and hitting Python's stack-limit. With the default recursion limit (1000), the recursion error occurs at about 115 nested imported, with limit 2000 at about 240, with limit 5000 at about 660.
时间: 2023-06-24 09:04:00 浏览: 731
这段话主要讲的是Python的堆栈限制问题。Python的堆栈限制是为了防止无限递归而导致内存被耗尽。而PyInstaller会递归地导入模块。如果你的程序中模块的导入结构不太合理,就会导致递归嵌套过深,从而超出Python的堆栈限制。默认的递归限制是1000,大约在115个嵌套导入时就会出现递归错误,限制为2000时约为240个,限制为5000时约为660个。
相关问题
============================================================= A RecursionError (maximum recursion depth exceeded) occurred. For working around please follow these instructions ============================================================= 1. In your program's .spec file add this line near the top:: import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5) 2. Build your program by running PyInstaller with the .spec file as argument:: pyinstaller myprog.spec 3. If this fails, you most probably hit an endless recursion in PyInstaller. Please try to track this down has far as possible, create a minimal example so we can reproduce and open an issue at https://github.com/pyinstaller/pyinstaller/issues following the instructions in the issue template. Many thanks. Explanation: Python's stack-limit is a safety-belt against endless recursion, eating up memory. PyInstaller imports modules recursively. If the structure how modules are imported within your program is awkward, this leads to the nesting being too deep and hitting Python's stack-limit. With the default recursion limit (1000), the recursion error occurs at about 115 nested imported, with limit 2000 at about 240, with limit 5000 at about 660. 翻译一下
出现了递归错误(超过最大递归深度),需要按照以下步骤进行解决:
1. 在程序的 .spec 文件中,在顶部附近添加以下代码:
import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)
这将增加Python的递归深度限制,以防止出现此错误。
2. 使用 .spec 文件作为参数运行 PyInstaller 来构建程序:
pyinstaller myprog.spec
3. 如果构建失败,则可能是因为 PyInstaller 中出现了无限递归问题。请尝试跟踪此问题,创建一个简化的示例程序以便我们能够重现,然后在 https://github.com/pyinstaller/pyinstaller/issues 上开启一个问题并按照问题模板中的说明进行操作。
这个错误的原因是因为Python的堆栈限制是为了防止无限递归和内存泄漏。PyInstaller会递归地导入程序中使用的所有模块,如果模块之间的导入结构不合适,则可能会导致递归深度过大,从而触发此错误。默认情况下,Python的递归深度限制是1000,如果超过此限制,则会出现递归错误,而递归深度限制可以通过上述第一步中的代码进行修改。
Table: Employee t-- ---- Column Namel Type t-- id name salary managerId --+- int varchar int int - ------+---------- id is the primary key column for this table. Each row of this table indicates the ID of an employee, their name, salary, and the ID of their manager. Write an SQL query to find the employees who earn more than their managers. Return the result table in any order. The query result format is in the following example Example 1: Input: Employee table: +----+-- ---+-- salary | managerId id name +------- 一+-- 1 Joe 70000 2 Henryl 80000 3 Sam 4Max 60000 C 90000 +-- -+- 3 14 Null Null -+ Output: +--- ---+ Employeel +----------+ Joe -- Explanation: Joe is the only employee who earns more than his manager.
你可以使用以下 SQL 查询来找到工资高于他们的经理的雇员:
```sql
SELECT e1.name AS Employee
FROM Employee e1
JOIN Employee e2 ON e1.managerId = e2.id
WHERE e1.salary > e2.salary;
```
这个查询使用了自连接(self join),通过将 `Employee` 表与自身进行连接,将每个雇员与他们的经理进行比较。然后,在 `WHERE` 子句中,筛选出工资高于其经理的雇员。
查询结果将返回一个结果表,其中包含满足条件的雇员的姓名。
希望这个查询能够满足你的需求!如果还有其他问题,请随时提问。
阅读全文