Python pip安装错误(羽毛格式)

时间:2016-06-04 15:16:30

标签: python c++

过去几天我一直在尝试为Python(https://pypi.python.org/pypi/feather-format)安装Feather文件格式,但没有运气。我在Windows 10上使用Anaconda2。当我尝试pip install feather-format时出现以下错误:

 Collecting feather-format
      Using cached feather-format-0.2.0.tar.gz
    Requirement already satisfied (use --upgrade to upgrade): cython>=0.21 in c:\users\pete\anaconda2\lib\site-packages (from feather-format)
    Building wheels for collected packages: feather-format
      Running setup.py bdist_wheel for feather-format ... error
      Complete output from command C:\Users\pete\Anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pete\\appdata\\local\\temp\\pip-build-g4egjo\\feather-format\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\pete\appdata\local\temp\tmp1gwqlopip-wheel- --python-tag cp27:
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-2.7
      creating build\lib.win-amd64-2.7\feather
      copying feather\api.py -> build\lib.win-amd64-2.7\feather
      copying feather\compat.py -> build\lib.win-amd64-2.7\feather
      copying feather\version.py -> build\lib.win-amd64-2.7\feather
      copying feather\__init__.py -> build\lib.win-amd64-2.7\feather
      creating build\lib.win-amd64-2.7\feather\tests
      copying feather\tests\test_reader.py -> build\lib.win-amd64-2.7\feather\tests
      copying feather\tests\__init__.py -> build\lib.win-amd64-2.7\feather\tests
      copying feather\libfeather.pxd -> build\lib.win-amd64-2.7\feather
      copying feather\ext.pyx -> build\lib.win-amd64-2.7\feather
      running build_ext
      building 'feather.ext' extension
      creating build\temp.win-amd64-2.7
      creating build\temp.win-amd64-2.7\Release
      creating build\temp.win-amd64-2.7\Release\feather
      creating build\temp.win-amd64-2.7\Release\src
      creating build\temp.win-amd64-2.7\Release\src\feather
      C:\Users\pete\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ifeather -IC:\Users\pete\Anaconda2\lib\site-packages\numpy\core\include -Ic:\users\pete\appdata\local\temp\pip-build-g4egjo\feather-format\src -IC:\Users\pete\Anaconda2\include -IC:\Users\pete\Anaconda2\PC /Tpfeather/ext.cpp /Fobuild\temp.win-amd64-2.7\Release\feather/ext.obj -std=c++11 -O3
      cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
      cl : Command line warning D9002 : ignoring unknown option '-O3'
      ext.cpp
      C:\Users\pete\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
      feather/ext.cpp(279) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
      error: command 'C:\\Users\\pete\\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 feather-format
      Running setup.py clean for feather-format
    Failed to build feather-format
    Installing collected packages: feather-format
      Running setup.py install for feather-format ... error
        Complete output from command C:\Users\pete\Anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pete\\appdata\\local\\temp\\pip-build-g4egjo\\feather-format\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\pete\appdata\local\temp\pip-itehjl-record\install-record.txt --single-version-externally-managed --compile:
        Compiling feather/ext.pyx because it changed.
        [1/1] Cythonizing feather/ext.pyx
        running install
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-2.7
        creating build\lib.win-amd64-2.7\feather
        copying feather\api.py -> build\lib.win-amd64-2.7\feather
        copying feather\compat.py -> build\lib.win-amd64-2.7\feather
        copying feather\version.py -> build\lib.win-amd64-2.7\feather
        copying feather\__init__.py -> build\lib.win-amd64-2.7\feather
        creating build\lib.win-amd64-2.7\feather\tests
        copying feather\tests\test_reader.py -> build\lib.win-amd64-2.7\feather\tests
        copying feather\tests\__init__.py -> build\lib.win-amd64-2.7\feather\tests
        copying feather\libfeather.pxd -> build\lib.win-amd64-2.7\feather
        copying feather\ext.pyx -> build\lib.win-amd64-2.7\feather
        running build_ext
        building 'feather.ext' extension
        creating build\temp.win-amd64-2.7
        creating build\temp.win-amd64-2.7\Release
        creating build\temp.win-amd64-2.7\Release\feather
        creating build\temp.win-amd64-2.7\Release\src
        creating build\temp.win-amd64-2.7\Release\src\feather
        C:\Users\pete\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ifeather -IC:\Users\pete\Anaconda2\lib\site-packages\numpy\core\include -Ic:\users\pete\appdata\local\temp\pip-build-g4egjo\feather-format\src -IC:\Users\pete\Anaconda2\include -IC:\Users\pete\Anaconda2\PC /Tpfeather/ext.cpp /Fobuild\temp.win-amd64-2.7\Release\feather/ext.obj -std=c++11 -O3
        cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
        cl : Command line warning D9002 : ignoring unknown option '-O3'
        ext.cpp
        C:\Users\pete\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
        feather/ext.cpp(303) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
        error: command 'C:\\Users\\pete\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

        ----------------------------------------
    Command "C:\Users\pete\Anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pete\\appdata\\local\\temp\\pip-build-g4egjo\\feather-format\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\pete\appdata\local\temp\pip-itehjl-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\pete\appdata\local\temp\pip-build-g4egjo\feather-format\
    You are using pip version 8.1.1, however version 8.1.2 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.

这一切似乎都与c ++有关。我已经安装(并重新安装)了Microsoft Visual C ++编译器Python(https://www.microsoft.com/en-us/download/details.aspx?id=44266)。我还安装了Visual Studio 2015。

能够使用

安装羽毛格式
conda install feather-format

但是当我在脚本中包含feather时出现以下错误:

Unhandled exception in thread started by <function wrapper at 0x000000001967B208>
Traceback (most recent call last):
  File "C:\Users\pete\Anaconda2\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\pete\Anaconda2\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "C:\Users\pete\Anaconda2\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
    six.reraise(*_exception)
  File "C:\Users\pete\Anaconda2\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\pete\Anaconda2\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\pete\Anaconda2\lib\site-packages\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\Users\pete\Anaconda2\lib\site-packages\django\apps\config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\pete\Anaconda2\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\pete\Projects\datm2\core\models.py", line 22, in <module>
    import feather
  File "C:\Users\pete\Anaconda2\lib\site-packages\feather\__init__.py", line 17, in <module>
    from feather.api import read_dataframe, write_dataframe
  File "C:\Users\pete\Anaconda2\lib\site-packages\feather\api.py", line 21, in <module>
    import feather.ext as ext
ImportError: No module named ext

似乎无法从源目录编译(?)文件“ext.pyx”。任何帮助将不胜感激,非常感谢。

1 个答案:

答案 0 :(得分:5)

我在为Python安装Feather Format时遇到了同样的问题。您可以在命令行上尝试此代码

conda install feather-format -c conda-forge 

错误的原因可能是C ++的编译器错误,您可以使用conda-forge作为编译器。这已经集成在Anaconda中。