
최근에 pip를 사용하여 패키지를 설치하려고 시도했는데 pip install... 명령을 입력하고 Enter 키를 누르면 아무 일도 일어나지 않고 프로세스가 중단되거나 루프에서 실행되는 것 같습니다. 입력이 없고 터미널을 닫습니다.
그 동안 나는 파이썬을 업데이트했습니다. 제가 뭔가 잘못된 일을 했을지도 모른다고 생각합니다. 하지만 터미널 초보자로서 무엇이 잘못되었을지 잘 모르겠습니다.
pip를 다시 설치해야겠다고 생각했는데 아래와 같은 오류가 반환되었습니다.
어디서 조사해야 할지 아시나요?
$ sudo apt-get install python-pip
[sudo] password for benoit:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pip is already the newest version (8.1.1-2ubuntu0.4).
The following packages were automatically installed and are no longer required:
libgles1-mesa linux-headers-4.8.0-36 linux-headers-4.8.0-36-generic
linux-headers-4.8.0-39 linux-headers-4.8.0-39-generic linux-headers-4.8.0-41
linux-headers-4.8.0-41-generic linux-headers-4.8.0-45
linux-headers-4.8.0-45-generic linux-headers-4.8.0-46
linux-headers-4.8.0-46-generic linux-headers-4.8.0-49
linux-headers-4.8.0-49-generic linux-image-4.8.0-36-generic
linux-image-4.8.0-39-generic linux-image-4.8.0-41-generic
linux-image-4.8.0-45-generic linux-image-4.8.0-46-generic
linux-image-4.8.0-49-generic linux-image-extra-4.8.0-36-generic
linux-image-extra-4.8.0-39-generic linux-image-extra-4.8.0-41-generic
linux-image-extra-4.8.0-45-generic linux-image-extra-4.8.0-46-generic
linux-image-extra-4.8.0-49-generic snap-confine
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
python3-update-manager update-manager
The following packages will be upgraded:
python3-update-manager update-manager
2 upgraded, 0 newly installed, 0 to remove and 61 not upgraded.
48 not fully installed or removed.
Need to get 0 B/575 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 420706 files and directories currently installed.)
Preparing to unpack .../python3-update-manager_1%3a16.04.6_all.deb ...
File "/usr/bin/py3clean", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3clean on line 4, but no encoding declared; see python.org/dev/peps/pep-0263/ for details
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
File "/usr/bin/py3clean", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3clean on line 4, but no encoding declared; see python.org/dev/peps/pep-0263/ for details
dpkg: error processing archive /var/cache/apt/archives/python3-update-manager_1%3a16.04.6_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
File "/usr/bin/py3compile", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3compile on line 4, but no encoding declared; see python.org/dev/peps/pep-0263/ for details
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Preparing to unpack .../update-manager_1%3a16.04.6_all.deb ...
File "/usr/bin/py3clean", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3clean on line 4, but no encoding declared; see python.org/dev/peps/pep-0263/ for details
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
File "/usr/bin/py3clean", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3clean on line 4, but no encoding declared; see python.org/dev/peps/pep-0263/ for details
dpkg: error processing archive /var/cache/apt/archives/update-manager_1%3a16.04.6_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
File "/usr/bin/py3compile", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3compile on line 4, but no encoding declared; see python.org/dev/peps/pep-0263/ for details
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/python3-update-manager_1%3a16.04.6_all.deb
/var/cache/apt/archives/update-manager_1%3a16.04.6_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
내가 얻는 것은 다음과 같습니다.
/$ sudo apt-get update
Hit:1 archive.canonical.com/ubuntu xenial InRelease
Get:2 ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu xenial InRelease [17,5 kB]
Hit:3 ca.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 ca.archive.ubuntu.com/ubuntu xenial-security InRelease
Hit:5 ppa.launchpad.net/teejee2008/ppa/ubuntu xenial InRelease
Ign:6 repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease
Hit:7 repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release
Ign:8 dl.google.com/linux/chrome/deb stable InRelease
Ign:9 dl.google.com/linux/earth/deb stable InRelease
Ign:10 dl.google.com/linux/talkplugin/deb stable InRelease
Ign:2 ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu xenial InRelease
Hit:11 dl.google.com/linux/chrome/deb stable Release
Hit:12 dl.google.com/linux/earth/deb stable Release
Hit:15 dl.google.com/linux/talkplugin/deb stable Release
Fetched 17,5 kB in 0s (29,9 kB/s)
Reading package lists... Done
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:24 and /etc/apt/sources.list.d/google-chrome.list:3
...
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:24 and /etc/apt/sources.list.d/google-chrome.list:3
source.list를 다시 생성했는데도 위에서 언급한 오류가 발생합니다. 현재 상황은 다음과 같습니다.
답변1
Curl과 Python을 사용하여 pip를 설치하는 또 다른 쉬운 방법이 있습니다.
sudo apt-get update
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python get-pip.py
이제 pip 설치를 확인하십시오. 터미널에 pip를 작성하십시오. 일부 코드를 볼 수 있습니다.
버전을 확인하고 싶다면
pip -V