RHEL 인스턴스에 Python 패키지를 설치하려고 하는데 pip
pip 명령을 실행하려고 하면 이 오류가 발생합니다.
Pip은 이전에도 작동했지만 갑자기(무슨 짓을 했는지는 모르겠지만) 이렇게 실패하기 시작했습니다.
[root@universe: ~]# pip --version
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==18.1', 'console_scripts', 'pip')()
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 378, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2566, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2260, in load
File "/usr/lib/python2.6/site-packages/pip-18.1-py2.6.egg/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python2.6/site-packages/pip-18.1-py2.6.egg/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python2.6/site-packages/pip-18.1-py2.6.egg/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python2.6/site-packages/pip-18.1-py2.6.egg/pip/_internal/cli/cmdoptions.py", line 75
binary_only = FormatControl(set(), {':all:'})
^
SyntaxError: invalid syntax
[root@universe: ~]#
pip 재설치를 시도했지만 python-setuptools
종속 항목이 누락되었다는 오류가 발생했습니다.
[root@universe: ~]# yum install python-pip
Loaded plugins: product-id, rhnplugin, security, subscription-manager
There was an error communicating with RHN.
RHN Satellite or RHN Classic support will be disabled.
Error Message:
Please run rhn_register as root on this client
Error Class Code: 9
Error Class Info: Invalid System Credentials.
Explanation:
An error has occurred while processing your request. If this problem
persists please enter a bug report at bugzilla.redhat.com.
If you choose to submit the bug report, please be sure to include
details of what you were trying to do when this error occurred and
details on how to reproduce this problem.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-pip.noarch 0:7.1.0-1.el6 will be installed
--> Processing Dependency: python-setuptools for package: python-pip-7.1.0-1.el6.noarch
--> Finished Dependency Resolution
Error: Package: python-pip-7.1.0-1.el6.noarch (epel)
Requires: python-setuptools
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@universe: ~]#
설치하려고 하면 python-setuptools
패키지를 찾을 수 없다는 메시지가 표시됩니다.
[root@universe: ~]# yum install python-setuptools
Loaded plugins: product-id, rhnplugin, security, subscription-manager
There was an error communicating with RHN.
RHN Satellite or RHN Classic support will be disabled.
Error Message:
Please run rhn_register as root on this client
Error Class Code: 9
Error Class Info: Invalid System Credentials.
Explanation:
An error has occurred while processing your request. If this problem
persists please enter a bug report at bugzilla.redhat.com.
If you choose to submit the bug report, please be sure to include
details of what you were trying to do when this error occurred and
details on how to reproduce this problem.
Setting up Install Process
No package python-setuptools available.
Error: Nothing to do
[root@universe: ~]#
답변1
set
리터럴 구문을 사용하여 오류가 발생한 것 같습니다 {':all:'}
.
set
텍스트를 사용하여 {}
이미 생성됨Python 3.1에서 도입되었으며 2.7로 백포트되었습니다..
구문이 없고 얼마 전에 중단된 Python 2.6 인터프리터를 사용하면 SyntaxError
예상한 결과를 얻을 수 있습니다.
한 가지 해결책은 Python 버전을 전역적으로 업그레이드하는 것입니다.중요한 시스템 구성 요소가 손상될 가능성이 높으므로 반드시 확인해야 합니다..
또 다른 더 나은 옵션은 Python 인터프리터용 가상 환경(예: virtualenv
)을 사용하는 것입니다.