본문 바로가기

Python

[Python] python3 -m venv .venv error (feat. ubuntu)

반응형

error

아래 처럼 venv로 가상환경을 만드려고 했는데 에러가 났다.

root:/test# python3 -m venv .venv
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt install python3.8-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/test/.venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

안내와 같이 아래 코드를 실행하자.

apt install python3.8-venv

또 에러가 났다.

apt install python3.8-venv


Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-dev python3.8-minimal
Suggested packages:
  python3.8-doc binfmt-support
The following NEW packages will be installed:
  python3.8-venv
The following packages will be upgraded:
  libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-dev python3.8-minimal
7 upgraded, 1 newly installed, 0 to remove and 213 not upgraded.
Need to get 10.8 MB of archives.
After this operation, 42.0 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Ign:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.5
Ign:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.5
Ign:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8 amd64 3.8.10-0ubuntu1~20.04.5
Ign:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8 amd64 3.8.10-0ubuntu1~20.04.5
Ign:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-stdlib amd64 3.8.10-0ubuntu1~20.04.5
Ign:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-minimal amd64 3.8.10-0ubuntu1~20.04.5
Ign:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-minimal amd64 3.8.10-0ubuntu1~20.04.5
Ign:8 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.5
Err:1 http://security.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
Err:2 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
Err:3 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8 amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
Err:4 http://security.ubuntu.com/ubuntu focal-updates/main amd64 python3.8 amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
Err:5 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-stdlib amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
Err:6 http://security.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-minimal amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
Err:7 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-minimal amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
Err:8 http://security.ubuntu.com/ubuntu focal-updates/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.5
  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.8/python3.8-dev_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.8/libpython3.8-dev_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.8/libpython3.8_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.8/python3.8_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.8/libpython3.8-stdlib_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.8/python3.8-minimal_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.8/libpython3.8-minimal_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/p/python3.8/python3.8-venv_3.8.10-0ubuntu1~20.04.5_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

해결

apt를 업데이트 해주자.

apt update

잘됨><

 

다른 에러

https://24hours-beginner.tistory.com/449

 

[Python] python3 가상환경 만들기 error

error Error: Command ‘[‘/home/test/env/bin/python3’, ‘-Im’, ‘ensurepip’, ‘–upgrade’, ‘–default-pip’]’ returned non-zero exit status 해결 --without-pip 옵션을 준다. python3 -m venv 경로명 --without-pip 다른 error http

24hours-beginner.tistory.com

 

가상환경 / venv 생성

https://24hours-beginner.tistory.com/245

 

[Python] venv 생성/실행 (가상환경)(python package 따로 관리)

참고 python 3.6.15 자습서 - 12. 가상 환경 및 패키지 0. venv 가상 환경을 만들고 관리하는 데 사용되는 모듈 1. 생성 (python3 -m venv [디렉토리 경로]) # ubuntu python3 -m venv [디렉토리 경로] # windows python -m ve

24hours-beginner.tistory.com

 

반응형