简体   繁体   中英

fatal error C1083: Cannot open include file: 'dlfcn.h': No such file or directory PyLPSolve

[CLOSED] I'm trying install pylpsolve using python 2.7 on windows 10, 64 bits. When I run python setup.py install I've the following error: fatal error C1083: Cannot open include file: 'dlfcn.h': No such file or directory . I have searched the web (specifically here and here ) and can not find solution. I hope you can help me.

First, you should note that pylpsolve seems to be pretty much dead. It never supported Windows, seems to have a lot of outstanding pull requests, and in my testing seems to have some bugs.

On the other hand, you may be able to make use of it and it is not too difficult to fix your problem. You are getting the message because the setup.py is essentially re-compiling lpsolve and in the process, doing it for linux not Windows. The setup.py might work properly as is on linux but on windows you'll need to make a few changes.

I think the key changes are to add these values to the compiler arguments in setup.py:

"-D_WINDLL", "-DWIN32"

I have got a successful compile using the following lines in my setup.py .

lpsolve_base = 'lp_solve_5.5'

compiler_args = ["/Gz", "/Zp8", "-D_WINDLL", "-DWIN32", "-D_CRT_SECURE_NO_DEPRECATE",
                 "-D_CRT_NONSTDC_NO_DEPRECATE", "-DYY_NEVER_INTERACTIVE", "-DPARSER_LP",
                 "-DINVERSE_ACTIVE=INVERSE_LUSOL", "-DRoleIsExternalInvEngine"]

extensions = [
    Extension("pylpsolve",
    include_dirs = [os.path.join(lpsolve_base, d) for d in ['.',
                    'shared', 'bfp', 'bfp/bfp_LUSOL', 'bfp/bfp_LUSOL/LUSOL',
                    'colamd']] + [numpy.get_include()],
    sources = ["pylpsolve.pyx"] + [os.path.join(lpsolve_base, f) for f in
                ['lp_MDO.c', 'shared/commonlib.c', 'shared/mmio.c', 'shared/myblas.c',
                 'ini.c', 'fortify.c', 'colamd/colamd.c', 'lp_rlp.c', 'lp_crash.c',
                 'bfp/bfp_LUSOL/lp_LUSOL.c', 'bfp/bfp_LUSOL/LUSOL/lusol.c', 'lp_Hash.c',
                 'lp_lib.c', 'lp_wlp.c', 'lp_matrix.c', 'lp_mipbb.c', 'lp_MPS.c', 'lp_params.c',
                 'lp_presolve.c', 'lp_price.c', 'lp_pricePSE.c', 'lp_report.c', 'lp_scale.c',
                 'lp_simplex.c', 'lp_SOS.c', 'lp_utils.c', 'yacc_read.c']],
    extra_compile_args = compiler_args + ['/EHsc']
   )
]

setup(
  name = 'pylpsolve',
  ext_modules = cythonize(extensions),
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM