Create an executable from a python script (NumPy)

3

Sorry that seems like a very simple doubt, but it is the first time that I do this and I am having difficulties. I have created with spyder, a software that brings anaconda, a calculator of systems of equations, in which I have used the numpy module, and when saving and executing it in a console the following error appears:

 Traceback (most recent call last):
  File "calc_sist_ec.py", line 13, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

As far as I can see, I can not access the numpy module from outside Spyder, I would like to know if I could create an .exe with this code and run it on any computer (Windows) if I do not have python installed

import numpy as np

print(" ")
print("Calculadora de sistemas de ecuaciones (x,y)")
print("Autor: ---")
print("v.1.0")
print(" ")
print("-INSTRUCCIONES-")
print(" ")
print("1º.-Escribe los coeficientes del primer sistema, sin parte literal (Escribir los terminos uno a uno)")

var1=int(input("T1="))
var2=int(input("T2="))
var3=int(input("T3="))

print(" ")
print("2º.-Ahora, escribe los del segundo sistema")
print(" ")

var4=int(input("T1="))
var5=int(input("T2="))
var6=int(input("T3="))

a=np.array([[var1,var2],[var4,var5]])#a=ecuaciones con coeficientes

b=np.array([var3,var6])#b=ecuaciones con coeficientes

c=np.linalg.solve(a,b)#numpy.algebra_lineal_resolver(var_a,var_b)

print(" ")

print(c)#imprime el resultado
print(" ")
print("Nota: El primer resultado siempre será (x), y el segundo (y)")

Sorry for this simple doubt, thanks in advance.

    
asked by Nexobeta28 YT 07.05.2018 в 21:38
source

1 answer

1

You must make sure that in the terminal that executes the code you are using the python that Anaconda brings, if you do not have it by default it will use the system python that may not be the same version that you used to create the script or in your case I do not have numpy installed.

    
answered by 26.05.2018 в 19:25