Python 属性错误:';模块';对象没有属性'__版本&';运行可执行文件
我创建了一个可以通过Python正常工作的脚本,然后创建了一个可执行文件,得到了错误:Python 属性错误:';模块';对象没有属性'__版本&';运行可执行文件,python,pandas,numpy,pyinstaller,Python,Pandas,Numpy,Pyinstaller,我创建了一个可以通过Python正常工作的脚本,然后创建了一个可执行文件,得到了错误: File "site-packages\pandas\compat\numpy\__init__.py", line 11, in <module> AttributeError: 'module' object has no attribute '__version__' 你知道吗?我发现了问题 为了使用模块arcpy,我创建了名为pyi\u rth\u arcpy.py的runtime\u
File "site-packages\pandas\compat\numpy\__init__.py", line 11, in <module>
AttributeError: 'module' object has no attribute '__version__'
你知道吗?我发现了问题
为了使用模块arcpy
,我创建了名为pyi\u rth\u arcpy.py
的runtime\u hook
(我从另一个问题复制)。
在这个脚本中,我添加了一个假的站点包
和numpy
模块到sys.path
,这就产生了导入
问题
我刚把它改成了pyi\u rth\u arcpy.py
,numpy
一个我不用的模块,我选择了scipy
这是pyi\u rth\u arcpy.py
:
import sys
# Add arcpy's directories to sys.path
from archook import get_arcpy
get_arcpy()
# Additional tweaks to placate arcpy
from types import ModuleType
sys.path.append('./site-packages') # Add a dummy site-packages folder to sys.path
sys.modules['scipy'] = ModuleType('scipy') # Add a fake scipy module to sys.modules
import sys
# Add arcpy's directories to sys.path
from archook import get_arcpy
get_arcpy()
# Additional tweaks to placate arcpy
from types import ModuleType
sys.path.append('./site-packages') # Add a dummy site-packages folder to sys.path
sys.modules['scipy'] = ModuleType('scipy') # Add a fake scipy module to sys.modules