I have an old iMac running High Sierra and I use the Anaconda distribution of python 3.7. I've been using Anaconda for over 2 years and it has worked fine. I have a test code I've run over 100 times to be sure my python still works after doing something stupid on my computer. About a week ago I was trying to get a python script to run and input some bad parameters into the code. This appeared to lock up my computer and without thinking I manually restarted my computer.
Now I can't seem to get python to work no matter what I do. Before this I had run python scripts using Atom and VSCode. Both worked fine and I checked both out with my test code many times. I would also run Python from the command line and it worked fine as well. Now when I try to run a script in Atom or VSCode it doesn't work. Sometimes it gives me an "Illegal instruction: 4" message. And other times I get "No module named vpython found. Even though I installed vpython on my machine using conda install vpython
.
When I run my test code from the terminal I get an immediate return which says "Illegal instruction: 4". My test code doesn't use vpython.
I have deleted and reinstalled the Anaconda Python twice. I do not have time machine working on my computer so I'd like to fix this issue. Does anyone know why I keep getting the illegal instruction 4 when I run from the command line?
Details:
- macOS 10.13.6
Python:
which python3 /Users/myname/opt/anaconda3/bin/python3
I just wrote a simple script and it ran fine in the terminal. The script read in a number and printed it back out and also printed version of python it was using. The source code is:
num = int(input("Enter a number: "))
print(num)
import sys
print(sys.version)
Adding any one of these three lines to the above script causes the illegal instruction 4 output.
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
So it seems to be something due to these import commands. Although import system works fine!
python3
? So that we know that python works or not. If it works, we'd need to see the script.import sys print(sys.version)
- print is not allowed to be on same line with import keyword, it is marked as error when checking with mypy.