[python] Python 3 : ImportError“Setuptools라는 모듈 없음”

Python 3에서 패키지를 설치하는 데 문제가 있습니다.

나는 항상 패키지를 설치했다 setup.py install. 그러나 이제 ansicolors 패키지를 설치하려고하면 다음과 같은 결과가 나타납니다.

importerror “Setuptools라는 모듈 없음”

과거에 setuptools가 설치되어 있지 않아서 어떻게해야할지 모르겠습니다. 그래도 setup.py installsetuptools없이 많은 패키지를 설치할 수있었습니다 . 왜 setuptools를 받아야합니까?

Python 3.3이 있고 setuptools가 Python 3을 지원하지 않기 때문에 setuptools를 설치할 수도 없습니다.

설치 명령이 더 이상 작동하지 않는 이유는 무엇입니까?



답변

귀하의 setup.py파일이 필요합니다 setuptools. 일부 Python 패키지 distutils는 배포 에 사용 되었지만 이제는 setuptools보다 완전한 패키지 인을 사용 합니다. 다음 은 차이점에 대한 질문입니다.

setuptools데비안에 설치하려면 :

sudo apt-get install python3-setuptools

이전 버전의 Python (Python 2.x)의 경우 :

sudo apt-get install python-setuptools


답변

편집 : 공식 setuptools dox 페이지 :

python.org에서 Python 2> = 2.7.9 또는 Python 3> = 3.4를 설치 한 경우 이미 pip 및 setuptools가 있지만 최신 버전으로 업그레이드해야합니다.

Linux 또는 OS X에서 :

pip install -U pip setuptools 

Windows에서 :

python -m pip install -U pip setuptools

따라서이 게시물의 나머지 부분은 더 이상 사용되지 않을 수 있습니다 (예 : 일부 링크가 작동하지 않음).

배포 – “Python 3 지원을 제공하는”setuptools 포크입니다. 배포 (setuptools) + pip 설치 지침 :

curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip

비슷한 문제가 있습니다 .

업데이트 : 배포 는 더 이상 사용되지 않는 것 같습니다. 즉, Setuptools로 병합됩니다. Distribute는 더 이상 사용되지 않는 Setuptools 프로젝트의 포크입니다. Setuptools 0.7 릴리스부터 Setuptools 및 Distribute가 병합되었으며 Distribute는 더 이상 유지되지 않습니다. 진행중인 모든 노력은 Setuptools 프로젝트 및 Setuptools 설명서를 참조해야합니다.

setuptools pypi 페이지에 있는 지침으로 시도해 볼 수 있습니다 (테스트하지 않았습니다, 죄송합니다 :() :

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
easy_install pip


답변

python-2.6을 사용하여 Oracle Linux 6.4의 virtualenv 에서이 작업을 수행 했으므로 apt 기반 솔루션은 옵션이 아니며 python-2.7 아이디어도 아닙니다. 내 수정은 virtualenv에 의해 설치된 내 setuptools 버전을 업그레이드하는 것이 었습니다.

pip install --upgrade setuptools

그 후 패키지를 virtualenv에 설치할 수있었습니다. 이 질문에 이미 답변이 선택되어 있음을 알고 있지만이 답변이 내 상황에있는 다른 사람들을 도울 수 있기를 바랍니다.


답변

pip uninstall setuptools

그리고:

pip install setuptools

이것은 저에게 효과적이며 내 문제를 해결합니다.


답변

그만큼 distribute 패키지는 다음과 같은 Python 3 호환 버전을 제공합니다 setuptools. http://pypi.python.org/pypi/distribute

또한 사용 pip 모듈을 설치하는 데 사용하십시오. 종속성을 자동으로 찾아서 설치합니다.

그것은 당신의 패키지와 함께 나를 위해 잘 작동합니다 :

[~] pip --version
pip 1.2.1 from /usr/lib/python3.3/site-packages (python 3.3)
[~] sudo pip install ansicolors
Downloading/unpacking ansicolors
  Downloading ansicolors-1.0.2.tar.gz
  Running setup.py egg_info for package ansicolors

Installing collected packages: ansicolors
  Running setup.py install for ansicolors

Successfully installed ansicolors
Cleaning up...
[~]


답변

윈도우 7:

나는 완벽한 솔루션을 준 여기 파이썬 셀레늄 webdriver에 대한

1. Setup easy install (windows - simplified)
    a. download ez.setup.py (https://bootstrap.pypa.io/ez_setup.py) from 'https://pypi.python.org/pypi/setuptools'
    b. move ez.setup.py to C:\Python27\
    c. open cmd prompt
    d. cd C:\Python27\
    e. C:\Python27\python.exe ez.setup.py install


답변

PyPA 권장 설치 및 파이썬 패키지입니다 관리하기위한 도구 pip. pipPython 3.4 ( PEP 453 )에 포함되어 있지만 이전 버전의 경우 설치 방법은 다음과 같습니다. 경우 Windows에 다음과 같습니다.

https://bootstrap.pypa.io/get-pip.py 다운로드

>c:\Python33\python.exe get-pip.py
Downloading/unpacking pip
Downloading/unpacking setuptools
Installing collected packages: pip, setuptools
Successfully installed pip setuptools
Cleaning up...

>c:\Python33\Scripts\pip.exe install pymysql
Downloading/unpacking pymysql
Installing collected packages: pymysql
Successfully installed pymysql
Cleaning up...