我正在嘗試使用pip工具安裝scikits.audiolab。 Pip似乎在scikits.audiolab源目錄中運行命令python setup.py egg_info
。當這樣的時候,我得到這個錯誤:使用python setup.py時安裝scikits.audiolab時出錯egg_info
Andrews-MacBook-Pro-2:scikits.audiolab-0.11.0 andrewhannigan$ pip install scikits.audiolab
Collecting scikits.audiolab
Using cached scikits.audiolab-0.11.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/xb/qwlsm44s1wxfr82kytrgjtl80000gn/T/pip-build-vSZaU8/scikits.audiolab/setup.py", line 32, in <module>
from numpy.distutils.core import setup
ImportError: No module named numpy.distutils.core
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/xb/qwlsm44s1wxfr82kytrgjtl80000gn/T/pip-build-vSZaU8/scikits.audiolab
問題顯然是它無法導入numpy.distutils.core
。縱觀setup.py腳本,這種進口發生早期(在片段的下方底部):
#! /usr/bin/env python
# Last Change: Fri Mar 27 05:00 PM 2009 J
# Copyright (C) 2006-2007 Cournapeau David <[email protected]>
#
# This library is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option) any
# later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with this library; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# TODO:
# - check how to handle cmd line build options with distutils and use
# it in the building process
from os.path import join
import os
import sys
# The following is more or less random copy/paste from numpy.distutils ...
import setuptools
from distutils.errors import DistutilsError
from numpy.distutils.core import setup
奇怪的是,如果我只是通過python setup.py
運行setup.py腳本的上述片段,我沒有得到導入錯誤。 egg_info
命令行參數如何影響setup.py的運行方式,以及爲什麼突然使python無法從numpy.distutils.core
導入?
似乎不太可能,它是egg_info命令,而是點子正在改變以某種方式對環境.. 。點子使用正確的環境嗎?你可以用pip -V –
來檢查,或許這與你的問題有關:https://github.com/scipy/scipy/blob/v0.13.0b1/setup.py#L203 – denfromufa
如果numpy是這樣安裝的,那麼它可能會工作:pip安裝numpy - 用戶 – denfromufa