简体   繁体   中英

Why won't my computer run Python programs that import from sympy

I write this simple little Python program to give me the prime factors of a number:

from sympy import primefactors
number = int(input("Enter a number: "))
print("Prime factors", primefactors(number))

The program works when run within the Anaconda IDE but not outside of it - at least not on my computer. It runs perfectly on my wife's laptop and on my son's desktop without the need to launch Anaconda. They both run Window 10.

The same thing happens with any program headed from sympy import * . When I run the program in IDLE I get the error message

ModuleNotFoundError: No module named 'sympy'

Again, if I run the program on another computer I don't have this problem.

Does the problem lie my computer (i7-3770K, 16 GB RAM, Windows 10) or somewhere else?

OK, here's what I did. I had both python and anaconda on my computer, thinking that I needed to install python before anaconda. I deleted them both and then and reinstalled anaconda only. The problem programs now work as expected. Sorry if I've inconvenienced anyone.

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