3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Pythonをアップグレードしたらvenvが作成できなくなった

Last updated at Posted at 2021-05-17

概要

UbuntuのPython3を3.6から3.8にアップグレードしたらpython3 -m venv <プロジェクト名>を実行したら次のエラーが発生。

Error: Command '['/home/works/venv/<プロジェクト名>/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

対処

  1. pipなしでvenv環境を作成
    python3 -m venv --without-pip <プロジェクト名>
  2. setuptoolsをインストール
    sudo apt install python3-setuptools
  3. pipをインストール
    sudo apt install python3-pip
  4. 仮想環境からでる
    deactivate
  5. 仮想環境に入る
    source bin/active

しかし、仮想環境毎に同じ手順が必要なのでOSから入れ直した方が後々便利でした。

以上

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?