wsn icon indicating copy to clipboard operation
wsn copied to clipboard

I am getting error at genetic_algorithm import

Open ravichaurasia opened this issue 4 years ago • 4 comments

return importlib.import_module('genetic_algorithm') File "C:\ProgramData\Anaconda3\lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)

This is the error which iam getting, is it due to python version because I am using python 3x version

ravichaurasia avatar Feb 27 '20 08:02 ravichaurasia

I can't get the specific error from your discription. Maybe you can put up the whole error message.😂 Or you can refer to my example. I fixed some problems and run on PYTHON 3.7 and Window 10 portal-> (This is an incomplete version. )

I hope it works for you. 😀

HenryChen1 avatar Feb 27 '20 11:02 HenryChen1

C:\ProgramData\Anaconda3\envs\wsn-master\Scripts\python.exe D:/VT/code/wsn-master_NEW/wsn-master/run.py Traceback (most recent call last): File "D:/VT/code/wsn-master_NEW/wsn-master/run.py", line 6, in from python.network.network import Network File "D:\VT\code\wsn-master_NEW\wsn-master\python\network\network.py", line 8, in from python.sleep_scheduling.sleep_scheduler import * File "D:\VT\code\wsn-master_NEW\wsn-master\python\sleep_scheduling\sleep_scheduler.py", line 9, in from cc.genetic_algorithm import * File "D:\VT\code\wsn-master_NEW\wsn-master\cc\genetic_algorithm.py", line 13, in from . import _genetic_algorithm ImportError: cannot import name '_genetic_algorithm'

Again I am getting the same error

ravichaurasia avatar Feb 27 '20 18:02 ravichaurasia

I think you probably haven't compiled the C/C++ file yet (via SWIG)😮 Follow step 2 below. image

HenryChen1 avatar Feb 28 '20 07:02 HenryChen1

Build Precondition:

  1. Install SWIG
  2. Using python=2.7
  3. Change setup.py os.environ["CC"] = "g++-5 -std=c++11 to your version
  4. Change setup.py build_path to your path

And here you go: run python setup.py build_ext --inplace successfully 🎉 run python run.py

Opdoop avatar Aug 29 '20 13:08 Opdoop