[Python] Build Scikit-learn environment from scratch and # requires numpy+mkl problem

In order to simplify the operation, we can start the next pip: https://pypi.python.org/pypi/pip#downloads , don't forget to add the directory where pip is located to the environment variable.

(Open the Scripts folder in the Python installation directory first, it may be installed by default when Python is installed)


The operation after that is very simple, first install scikit_learn , open cmd and execute the following command:

pip install -U scikit-learn
@See  http://scikit-learn.org/stable/install.html

Then install the matching Scipy family bucket:

pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
@See https://www.scipy.org/install.html


The Scipy family bucket list is roughly as follows:

MarkupSafe-1.0
Send2Trash-1.5.0
backports-abc-0.5
backports.functools-lru-cache-1.5
backports.shutil-get-terminal-size-1.0.0
backports.shutil-which-3.5.1 bleach-2.1.3
colorama-0.3.9 configparser-3.5.0
cycler-0.10.0
decorator-4.2.1 entrypoints-0.2.3
enum34-1.1.6
functools32-3.2.3.post2
futures-3.2.0
html5lib-1.0.1
ipykernel-4.8.2
ipython-5.5.0
ipython-genutils-0.2.0
ipywidgets-7.1.2
jinja2-2.10
jsonschema-2.6.0
jupyter-1.0.0
jupyter-client-5.2.3
jupyter-console-5.2.0
jupyter-core-4.4.0
kiwisolver-1.0.1
matplotlib-2.2.0
mistune-0.8.3
mpmath-1.0.0
nbconvert-5.3.1
nbformat-4.4.0
nose-1.3.7
notebook-5.4.0
numpy-1.14.2
pandas-0.22.0
pandocfilters-1.4.2
pathlib2-2.3.0
pickleshare-0.7.4
prompt-toolkit-1.0.15
pygments-2.2.0
pyparsing-2.2.0
python-dateutil-2.7.0
pytz-2018.3
pywinpty-0.5.1
pyzmq-17.0.0
qtconsole-4.3.1
scandir-1.7
simplegeneric-0.8.1
singledispatch-3.4.0.3
six-1.11.0
sympy-1.1.1
finished-0.8.1
testpath-0.3.1
tornado-5.0
traitlets-4.3.2
wcwidth-0.1.7
webencodings-0.5.1
widgetsnbextension-3.1.4
win-unicode-console-0.5


The Scikit-learn environment is now set up. Next, go to the official website and copy a test sample to try:

from sklearn import datasets
from sklearn.model_selection import cross_val_predict
from sklearn import linear_model
import matplotlib.pyplot as plt

lr = linear_model.LinearRegression()
boston = datasets.load_boston()
y = boston.target

# cross_val_predict returns an array of the same size as `y` where each entry
# is a prediction obtained by cross validation:
predicted = cross_val_predict(lr, boston.data, y, cv=10)

fig, ax = plt.subplots()
ax.scatter(y, predicted, edgecolors=(0, 0, 0))
ax.plot([y.min(), y.max()], [y.min(), y.max()], 'k--', lw=4)
ax.set_xlabel('Measured')
ax.set_ylabel('Predicted')
plt.show()
The result is as follows:


----------------------------------------------

Error: # requires numpy+mkl

Excuting an order:

pip uninstall numpy
After uninstalling this old version, download a numpy+mkl package corresponding to the number of digits and the Python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy :

Put the downloaded package somewhere and execute the command:

pip install $path/packagename of your package.whl
*I have a backup python 2.7- 32 -bit package here: https://download.csdn.net/download/shenpibaipao/10288435
python 2.7- 64 -bit package: https://download.csdn.net/download/shenpibaipao/ 10394701

---------------------------

some pip commands

View installed modules:

pip list

Install the module:

pip install package name
Uninstall the module:

pip uninstall package name

Upgrade modules: (pull the latest version in the repository)

pip install --upgrade 包名


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325644716&siteId=291194637