virtualenv를 설치하려고 하는데 우분투 바이오닉에서 다음 오류가 발생합니다.
rock64@rockpro64:~$ pip3 install virtualenv virtualenvwrapper
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 29, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in <module>
from pip.locations import (
File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in <module>
from distutils import sysconfig
ImportError: cannot import name 'sysconfig
'하지만 distutils를 설치하려고 하면 다른 오류가 발생합니다:
rock64@rockpro64:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
python3-distutils python3-lib2to3
The following NEW packages will be installed:
python3-distutils python3-lib2to3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/222 kB of archives.
After this operation, 3,143 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 120131 files and directories currently installed.)
Preparing to unpack .../python3-lib2to3_3.6.9-1~18.04_all.deb ...
Unpacking python3-lib2to3 (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-lib2to3_3.6.9-1~18.04_all.deb (--unpack):
trying to overwrite '/usr/lib/python3.8/lib2to3/Grammar.txt', which is also in package python3.8-lib2to3 3.8.0-1+bionic2
Preparing to unpack .../python3-distutils_3.6.9-1~18.04_all.deb ...
Unpacking python3-distutils (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-distutils_3.6.9-1~18.04_all.deb (--unpack):
trying to overwrite '/usr/lib/python3.8/distutils/README', which is also in package python3.8-distutils 3.8.0-1+bionic2
Errors were encountered while processing:
/var/cache/apt/archives/python3-lib2to3_3.6.9-1~18.04_all.deb
/var/cache/apt/archives/python3-distutils_3.6.9-1~18.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
답변1
~에 따르면이 변경 로그 알림은 Python 3.8 릴리스의 최신 버전에 대한 것입니다., Deadsnakes PPA의 관리자는 자신의 버전이 업스트림 Ubuntu와 충돌한다는 것을 인정했습니다.
python3.8
최신 버전으로 업데이트하거나 완전히 제거하여 시작하세요 . python3.8-distutils
, python3.8-tk
, python3.8-gdbm
, 패키지를 제거해야 하며 python3.8-lib2to3
더 이상 Ubuntu 패키지와 충돌이 없어야 합니다.
python3-distutils
그런 다음 공식 Ubuntu 저장소에서 설치할 수 있으며 , 이를 통해 virtualenv
현재 발생한 문제가 해결될 것입니다.