安装tsne失败:pip install tsne无法工作

10

我无法在我的 Windows 机器上安装 tsne 包。我按照这里的指示安装了 Python 的 tsne 包,但是 pip install tsnepip install git+https://github.com/danielfrg/tsne.git 都不起作用。错误信息如下:

      tsne/bh_sne_src/quadtree.cpp(12) : fatal error C1083: Cannot open include file: 'cblas.h': No such file or directory
      error: command 'C:\\Users\\hzoe\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

      ----------------------------------------
      Failed building wheel for tsne
      Running setup.py clean for tsne
    Failed to build tsne
    Installing collected packages: tsne
      Running setup.py install for tsne: started
        Running setup.py install for tsne: finished with status 'error'
        Complete output from command C:\Users\hzoe\AppData\Local\Continuum\Anaconda\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\hzoe\\appdata\\local\\temp\\pip-build-vicxy7\\tsne\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\hzoe\appdata\local\temp\pip-so57qk-record\install-record.txt --single-version-externally-managed --compile:
        !!!!!!!!!!!!! ['tsne', 'tsne.tests']
        C:\Users\hzoe\AppData\Local\Continuum\Anaconda\lib\site-packages\setuptools-20.2.2-py2.7.egg\setuptools\dist.py:285: UserWarning: Normalizing 'v0.1.5' to '0.1.5'
        running install
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-2.7
        creating build\lib.win-amd64-2.7\tsne
        copying tsne\_version.py -> build\lib.win-amd64-2.7\tsne
        copying tsne\__init__.py -> build\lib.win-amd64-2.7\tsne
        creating build\lib.win-amd64-2.7\tsne\tests
        copying tsne\tests\test_iris.py -> build\lib.win-amd64-2.7\tsne\tests
        copying tsne\tests\__init__.py -> build\lib.win-amd64-2.7\tsne\tests
        UPDATING build\lib.win-amd64-2.7\tsne/_version.py
        set build\lib.win-amd64-2.7\tsne/_version.py to 'v0.1.5'
        running build_ext
        building 'bh_sne' extension
        creating build\temp.win-amd64-2.7
        creating build\temp.win-amd64-2.7\Release
        creating build\temp.win-amd64-2.7\Release\tsne
        creating build\temp.win-amd64-2.7\Release\tsne\bh_sne_src
        C:\Users\hzoe\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\hzoe\AppData\Local\Continuum\Anaconda\lib\site-packages\numpy\core\include -I/usr/local/include -Itsne/bh_sne_src/ -IC:\Users\hzoe\AppData\Local\Continuum\Anaconda\include -IC:\Users\hzoe\AppData\Local\Continuum\Anaconda\PC /Tptsne/bh_sne.cpp /Fobuild\temp.win-amd64-2.7\Release\tsne/bh_sne.obj -msse2 -O3 -fPIC -w
        cl : Command line warning D9025 : overriding '/W3' with '/w'
        cl : Command line warning D9002 : ignoring unknown option '-msse2'
        cl : Command line warning D9002 : ignoring unknown option '-O3'
        cl : Command line warning D9002 : ignoring unknown option '-fPIC'
        bh_sne.cpp
        c:\users\hzoe\appdata\local\continuum\anaconda\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
        C:\Users\hzoe\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
        C:\Users\hzoe\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\hzoe\AppData\Local\Continuum\Anaconda\lib\site-packages\numpy\core\include -I/usr/local/include -Itsne/bh_sne_src/ -IC:\Users\hzoe\AppData\Local\Continuum\Anaconda\include -IC:\Users\hzoe\AppData\Local\Continuum\Anaconda\PC /Tptsne/bh_sne_src/quadtree.cpp /Fobuild\temp.win-amd64-2.7\Release\tsne/bh_sne_src/quadtree.obj -msse2 -O3 -fPIC -w
        cl : Command line warning D9025 : overriding '/W3' with '/w'
        cl : Command line warning D9002 : ignoring unknown option '-msse2'
        cl : Command line warning D9002 : ignoring unknown option '-O3'
        cl : Command line warning D9002 : ignoring unknown option '-fPIC'
        quadtree.cpp
        tsne/bh_sne_src/quadtree.cpp(12) : fatal error C1083: Cannot open include file: 'cblas.h': No such file or directory
        error: command 'C:\\Users\\hzoe\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

        ----------------------------------------
    Command "C:\Users\hzoe\AppData\Local\Continuum\Anaconda\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\hzoe\\appdata\\local\\temp\\pip-build-vicxy7\\tsne\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\hzoe\appdata\local\temp\pip-so57qk-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\hzoe\appdata\local\temp\pip-build-vicxy7\tsne\
我正在使用Anaconda进行Python编程,并安装了Windows版的Visual C++编译器。

我正在使用Anaconda进行Python编程,并安装了Windows版的Visual C++编译器。


1
看起来你缺少一个头文件。包含 clbash.h 的库是否在你的 include 路径中? - user2393256
你能解决这个问题吗? - Jay
3个回答

1
尝试这个命令: conda install -c conda-forge tsne。来自Anaconda的参考 link

0

对不起,如果你已经尝试过这个了,但我没看到你在命令提示符中输入的内容以获得错误信息。

如果你没有设置pip路径变量,那么输入以下内容(只要更改路径即可,如果python安装在其他目录下也可以),记住大小写敏感!

C:\Python34\Scripts\pip install LIBRARY_NAME

我已经设置了pip路径变量。通常情况下,“pip install”会起作用,但这一次当我输入“pip install tsne”时,我收到了这个错误消息。 - Felicia.H

0

尝试从sklearn中导入TSNE。
在导入库的开头编写以下代码:

from sklearn.manifold import TSNE

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接