我在使用Windows7的Python 2.7中有一个精心构建的项目。它在今天之前运行良好,我只是在没有修改数周的情况下运行它。
今天,当我打开它并尝试运行它时,它给了我一些ImportError,它说numpy
和wx
包不是有效的Win32应用程序。所以我重新安装这些软件包(32位版本)。然后它是可执行的。
然而,事情变得甚至奇怪,它一直给出内存错误。我正在看任务管理器,显然可以看到当错误弹出时,内存只有半满。
我可以知道如何让它正常工作吗?
感谢。
修改
我尝试安装64位版本的Numpy来替换32位版本。但是,内存错误再次出现。
EDIT2:
以下是追溯numpy导入错误:
Traceback (most recent call last):
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\main.py", line 9, in <module>
import numpy as np
File "C:\Python27\lib\site-packages\numpy\__init__.py", line 154, in <module>
import add_newdocs
File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
from type_check import *
File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 5, in <module>
import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.
EDIT3:
我再次安装了32位numpy。现在内存错误又回来了。追溯如下:
Traceback (most recent call last):
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\main.py", line 55, in <module>
portfolio = Portfolio(portfolio_path, recovery_tree_path, tree_rule_path, output_path, history_length, horizon, simulation_number, simulation_mode, adjustment_mode, adjustment_node_list, segmentation_flag, segmentation_variable)
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\PortfolioClass.py", line 131, in __init__
self.LoadFromCSV()
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\PortfolioClass.py", line 139, in LoadFromCSV
self.load_accounts()
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\PortfolioClass.py", line 217, in load_accounts
acc = Account(account_id, vintage, sale_balance, LPAPerc2, Con_Score_Pre, Predicted_Contact_Type_ITC, thresholds, cost)
File "C:\Users\user\My Documents\Aptana Studio 3 Workspace\State Machine Version 4.0\AccountClass.py", line 153, in __init__
self._account_monthly_revenues = np.zeros((self._parent._simulation_number, self._parent._horizon))
MemoryError