When I try to import these packages I get an error message. This happens both in command line and in pyCharm. First I tried to run the following code:
from scipy import optimize
import matplotlib.pyplot as plt
import numpy as np
#import another library to get the data (I don't think it's relevant to show here)
def piecewise_linear(x, x0, d01: np.uint32, y0, y1, k1, k2, k3, k4):
x1 = x0 + d01
return np.piecewise(x, [x < x0, (x0 <= x < x1), x >= x1],
[lambda x_: k1 * x_ + y0 - k1 * x0, lambda x_: k2 * x_ + y0 - k2 * x0,
lambda x_: k3 * x_ + y1 - k3 * x1, lambda x_: k4 * x_ + y1 - k4 * x])
def segmentation(x, y):
optimal_values, _ = optimize.curve_fit(piecewise_linear, x, y)
plt.figure()
plt.plot(x, y, "o")
plt.plot(x, piecewise_linear(x, *optimal_values))
plt.show()
#get the data
#...
segmentation(x,y)
When I ran it I've got the following error: As I'm Brazilian the error message is naturally in Portuguese. It says "It was not possible to find the specified module"
The same error happens when I try to run this program from terminal. I've also tried this other topic's solution by downloading and trying to install several versions of numpy+mlk, but all of them couldn't be installed: the system shows a message saying these wheels are not compatible with my platform The problem is not only limited to scipy.optimize, when I try to import scipy itself or pywt I get the same error, as can be seen in this image