问题
I get the following error message using python v2.7.3 and scipy v0.11.0 with py2exe v0.6.9:
ImportError: No module named _csr
my setup.py:
from distutils.core import setup
import py2exe
setup(console=['demo.py'],
options = {
"py2exe": {"includes":["scipy.sparse", "scipy.sparse.sparsetools.csr",
"scipy.sparse.sparsetools._csr"]}
})
The question in scipy with py2exe couldn't helped me out.
回答1:
There are two reasons I can think of for why you might have gotten this error.
_csr.pyd
should normally live in\Python2.7\Lib\site-packages\scipy\sparse\sparsetools
. It is possible that for some reason it is not there - an easy fix could be to reinstallScipy
.- During the call to
setup
, ascipy.sparse.sparsetools._csr.py
file is generated. This file makes a call toimp.load_dynamic
, attempting to load the PYD file. This function can throw anImportError
, which could be a symptom of a missing file.
If this does not resolve the problem, it would be great if you could post the output (i.e., what gets printed to the DOS prompt) of python setup.py py2exe
- this should help narrow things down.
来源:https://stackoverflow.com/questions/14225124/py2exe-with-scipy-sparse-sparsetools-csr