LoginSignup
25
27

More than 5 years have passed since last update.

wslでpythonのvenv環境が作れない

Last updated at Posted at 2018-04-12

wslのUbuntuでPythonのvenv環境を作成しようとするとエラーになる。
解決方法が簡単にググれなかったのでメモを残しておく。

$ python3 -m venv xxx
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-get install python3-venv

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

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

下記ページを参照すると解決できる。マジすごい。
WSL の Ubuntu の Python に pip がない

リンク切れが起きた時のために簡単に手順を残しておく

$ python3 -m venv --without-pip testdir
$ cd testdir
$ source bin/activate
(testdir) $ wget https://bootstrap.pypa.io/get-pip.py
(testdir) $ python get-pip.py

wls python venvとかで検索するとみんなふつーに出来てるんだけどなんでだろ?

25
27
1

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
25
27