import geatpy 报错以及geatpy安装报错问题总结

情况一

Traceback (most recent call last):
  File "Untitled 5.py", line 1, in 
    import geatpy as ea
  File "/anaconda3/lib/python3.7/site-packages/geatpy-2.1.0-py3.7.egg/geatpy/__init__.py", line 47, in 
    from bs2int import bs2int
  File "__init__.pxd", line 918, in init bs2int
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

解决方法:

升级numpy至17.0

pip install --upgrade numpy

情况二:

mac安装geatpy报错,当mac系统在终端下pip install geatpy 时默认安装的是geatpy2.0.0版本(截止至19.7.29)。在此版本下import geatpy会报错:

	from awGA import awGA
ImportError:can not import name 'awGA' from 'awGA' (unknown location) 

解决方法:

去github上下载2.1.0版geatpy
https://github.com/geatpy-dev/geatpy
解压,将解压文件 geatpy-master放入默认路径
终端安装

 cd geatpy-master
 python setup.py install

问题解决

你可能感兴趣的:(python)