问题
I've been trying to get a working fast numpy with BLAS on Windows, and so far, the only method that seems feasible is downloading the precompiled library with MKL from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy.
So far ok, but chekcing later numpy.__config__.show()
, I see it points to directories that don't exist, such as C:\program files (x86)\IntelSWTools
I assume numpy is trying to place the MKL libraries in this directory, but I have no administration privileges for creating files in C:\program files (x86)
.
Is there any simple way to use this numpy distribution and install the MKL libs in another directory? Such as a pip install filename.whl --some_option_to_install_mkl_in_another_dir
?
(Windows 7 64bit, python 3.5.2)
Already attempted:
Use
pip install <package> --user
: it seems to install everything exactly the same way as the same command without--user
. (My default installation folder is aldready the user folder)User
pip install <package> --root <some_path>
: installs everything in the passed path, but Numpy config still points toC:\program files (x86)\IntelSWTools
, and python cannot find numpy, even if I add<some_path>
to bothPATH
andPYTHONPATH
environment varsTried to create the
pip.ini
file, with the lines[global]
andtarget=E:\destination
. The destination folder remains untouched.Rename the wheels file to
zip
, find all files containing the IntelSWTools folder, change all these folders to one that I have access to. Make it a wheels file again and pip install. Absolutely no file appears in the folder I chose, but numpy config is pointing to that folder. -- This makes me wonder: does this distribution really installs MKL?
回答1:
Numpy+MKL
does not place (or try to place) MKL libraries in C:\program files (x86)\IntelSWTools
. The MKL runtime DLLs necessary to use numpy+MKL are copied to sys.prefix\Lib\site-packages\numpy\core
during installation with pip.
C:\program files (x86)\IntelSWTools
is the location of the MKL development files (link libraries, header files, DLLs, documentation) that were used to build numpy+MKL. If you want to build other software from source that relies on MKL development files, you need to download MKL from Intel.
回答2:
I have tried something like this:
pip install --install-option="--prefix=$PREFIX_PATH" package_name
I the above line:
$PREFIX_PATH ---- Change the path you want to specify.
package_name ---- Change the Package name with the desired package name or the wheel file.
On Windows, I tried the above and it is not working. But the below answer will work:
python.exe -m pip install --target=c:\data\ pandas
The pandas got stored in the data
folder. Only the thing we need to do is we have to specify the path to our Python, so that it will fetch the proper library. You can go in the data
folder and run python. You will be able to access the library.
Hope this helps you.
来源:https://stackoverflow.com/questions/45757704/gohlkes-numpy-mkl-installation-change-mkl-install-directory-on-windows