How to stop my Python IDLE from restarting every time I import numpy module?

0

I imported numpy module in my script but whenever I execute it in my IDLE it is getting restarted every time saying:

========== RESTART: C:\Users\2303p\Desktop\python_code\np_array.py ========== =============================== RESTART: Shell ===============================

Even tried executing the script file from command prompt but no error there as well it simply doesn't print anything.

Below is the code:

import numpy as np

list1 = [1,2,3,4]

print(list1)

array1 = np.array(list1)

Just execute above in IDLE using F5 and restart message is displayed and nothing is printed.

Same code when executed in Pycharm prints:

Process finished with exit code -1073741819 (0xC0000005).

python-3.x
numpy
pycharm
python-idle
asked on Stack Overflow Sep 3, 2019 by psingh • edited Sep 4, 2019 by psingh

1 Answer

0

Actually it is behavior or python shell every time you run your script_file.py (any file name) using F5 it will restart the shell and and load every thing from scratch.

1. Load every import statement
2. It will initialize each variable again.
3. Initialize every function again.

enter image description here

Suggestion : If you don't want to reload each and every thing again and again you should go for Anaconda IDE it will be easy to use.

EDITED : Try to restart (close and reopen) your IDE, Also print(array1) at end it seems that you are not printing it. enter image description here

answered on Stack Overflow Sep 3, 2019 by Rahul Singh • edited Sep 3, 2019 by Rahul Singh

User contributions licensed under CC BY-SA 3.0