2014-07-07 5 views
2

Windows 7 64 비트 시스템이 있고 python 패키지 mgrs를 설치하려고합니다. easy_install과 python setup.py를 mgrs 디렉토리에 설치하여 실행 해 보았습니다. Easy_install은 아래 오류를 제공합니다. setuptools에이 확장python setuptools : ImportError : 이름을 가져올 수 없습니다. 라이브러리

으로 문제의 원인이 무엇에 어떤 도움을 라이브러리를 가져올에서 setup.py의

C:\Users\farrell>easy_install mgrs 
Searching for mgrs 
Reading https://pypi.python.org/simple/mgrs/ 
Best match: mgrs 1.1.0 
Downloading https://pypi.python.org/packages/source/m/mgrs/mgrs-1.1.0.tar.gz#md5 
=96e0c00f16d86a3f8b84c2c46cb68b8e 
Processing mgrs-1.1.0.tar.gz 
Writing c:\users\farrell\appdata\local\temp\easy_install-lzqjsi\mgrs-1.1.0\setup 
.cfg 
Running mgrs-1.1.0\setup.py -q bdist_egg --dist-dir c:\users\farrell\appdata\loc 
al\temp\easy_install-lzqjsi\mgrs-1.1.0\egg-dist-tmp-sxkdib 
Traceback (most recent call last): 
    File "C:\Python27\Anaconda\Scripts\easy_install-script.py", line 9, in <module 
> 
    load_entry_point('setuptools==5.4.1', 'console_scripts', 'easy_install')() 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 2147 
, in main 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 2133 
, in with_ei_usage 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 2150 
, in <lambda> 
    File "C:\Python27\Anaconda\lib\distutils\core.py", line 152, in setup 
    dist.run_commands() 
    File "C:\Python27\Anaconda\lib\distutils\dist.py", line 953, in run_commands 
    self.run_command(cmd) 
    File "C:\Python27\Anaconda\lib\distutils\dist.py", line 972, in run_command 
    cmd_obj.run() 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 370, 
in run 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 613, 
in easy_install 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 643, 
in install_item 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 833, 
in install_eggs 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1055 
, in build_and_install 
    File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1040 
, in run_setup 
    File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 63, in run_setup 
    File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 109, in run 
    File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 62, in runner 
    File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 38, in _execfile 
    File "c:\users\farrell\appdata\local\temp\easy_install-lzqjsi\mgrs-1.1.0\setup 
.py", line 8, in <module> 
ImportError: cannot import name Library 

라인 8 입니까?

+0

난 당신'setuptools' 모듈에는'Library'가 없습니다 내기를. 오래된 버전 일 수도 있습니다. 내'distribute-0.6.35'는 그것을 가지고 있습니다. –

답변

3

이전 버전의 setuptools에서는 Library 클래스를 setuptools 패키지로 가져 왔습니다. 버전 1.1부터는 그렇지 않습니다.

해당 setup.py 스크립트는 이전 버전의 setuptools에 대해 작성한 것입니다.

당신은 setup.py를 편집하고 가져 오기를 변경하여 문제를 해결 할 수 있어야한다 : 내장 된 DLL을 설치 보인다 윈도우에서이 특정 패키지의

from setuptools.extension import Library 

설치 후

site-packages 디렉토리로 복사하십시오. 한번 설치되면, mgrs\core.py을 편집하고 라인 교체 :

local_dlls = os.path.abspath(os.__file__ + "../../../DLLs") 

으로 :

import site 
local_dlls = ";".join(site.getsitepackages()) 
+0

내가 제안한 변경 사항을 적용했으며 설치가 완료된 것처럼 보입니다. 그러나 예를 들어 ipython을 열고 mgrs를 가져 오려고하면 해당 모듈이 없다고 전합니다. 더 이상의 생각? 아마도이 아나콘다 패키지가 있을까요? 아래는 내가 가진 설치 메시지입니다. 설치됨 c : \ python27 \ anaconda \ lib \ site-packages \ mgrs-1.1.0-py2.7-win-amd64.egg mgrs == 1.1.0에 대한 종속성 처리 검색 setuptools == 5.4.1 가장 일치하는 항목 : setuptools 5.4.1 처리 setuptools-5.4.1-py2.7.egg – user3473556

+0

내 컴퓨터에서 정상적으로 작동하는 편집을 참조하십시오. –

+0

고마워요. 나는이 변화를 만들었지 만 여전히 아래 오류를 얻는다. 파일 "", 라인 1, 파일 "C : \ Python27 \ 아나콘다 \ lib 디렉토리의 \ 사이트 - 패키지 \ MGRS-1.1.0-py2.7 - 윈 - amd64.egg \ MGRS \ init__.py __"에서, 라인 1, from core import rt 파일 "C : \ Python27 \ Anaconda \ lib \ site-packages \ mgrs-1.1.0-py2.7-win-amd64.egg \ mgrs \ core.py"파일에서 22, in rt = ctypes.PyDLL (lib_name) 파일 "C : \ Python27 \ Anaconda \ lib \ ctypes \ __ init__.py", 365 줄, __init__에 있음 self._handle = _dlopen (self._name, mode) WindowsError : [오류 126] 지정된 모듈을 찾을 수 없습니다. – user3473556

0

최신 버전의 SetupTools가 설치되어 있는지 확인하고 확인하십시오. 이 문제에 대한 이전 posts은 컴퓨터에 설치되어있는 SetupTools 버전과 관련이있었습니다. 또한 조금 낫기 때문에 easy_install 대신 pip을 시도 할 수도 있습니다.