Tôi đang cố gắng cài đặt scikits.audiolab bằng cách sử dụng công cụ pip. Pip xuất hiện để chạy lệnh python setup.py egg_info
từ bên trong thư mục nguồn scikits.audiolab. Khi làm như vậy, tôi gặp lỗi này:Lỗi khi cài đặt scikits.audiolab khi sử dụng python setup.py 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
Vấn đề rõ ràng là không thể nhập numpy.distutils.core
. Nhìn vào kịch bản setup.py, nhập khẩu điều này xảy ra rất sớm (ở dưới cùng của đoạn dưới đây):
#! /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
Phần lẻ là nếu tôi chỉ cần chạy đoạn mã trên của kịch bản setup.py qua python setup.py
, Tôi không nhận được lỗi nhập. Làm thế nào để đối số dòng lệnh egg_info
ảnh hưởng đến cách setup.py chạy và tại sao nó lại đột nhiên làm cho trăn không thể nhập từ numpy.distutils.core
?
vẻ không chắc rằng nó là lệnh egg_info, mà đúng hơn là pip được thay đổi môi trường một cách nào đó .. Pip có sử dụng đúng môi trường không? Bạn có thể kiểm tra điều đó bằng pip -V –
có lẽ vấn đề này liên quan đến vấn đề của bạn: https://github.com/scipy/scipy/blob/v0.13.0b1/setup.py#L203 – denfromufa
nếu cài đặt gọn gàng như thế này, sau đó nó có thể hoạt động: pip install numpy --user – denfromufa