5
6

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 5 years have passed since last update.

pythonで仮想環境(venv)を作った時のメモ

Last updated at Posted at 2017-12-26

#venvを使ってみる

#仮想環境の作成(エラー発生)
$ python3 -m venv <dir>
Error: Command '['/Users/kimurakouichi/workspace/a/new/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

anaconda上のpythonでvenvを使うと何やらよくないことが起こるらしい。

$ . bin/activate
-bash: bin/activate: No such file or directory

activateが作られてない

#解決方法
(http://nsaito-nmiri.hateblo.jp/entry/2017/08/14/183045)
↑こちらの記事を参考にすると

# 仮想環境の作成(pipなし)
$ python -m venv <dir>--without-pip

# get-pip.py の取得
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1558k  100 1558k    0     0  2940k      0 --:--:-- --:--:-- --:--:-- 2939k

でクリア

$ . bin/activate

でちゃんと仮想環境に入れた。

5
6
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
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?