TechBlog masa

  • Top
  • Posts
  • Profile
2025-06-01
SWE
venv, pyenvでpythonの仮想環境を作るvenv, pyenvでpythonの仮想環境を作る
Python

likes: 0

>> back to All Articles

Unsupported Block: unsupported

 

Unsupported Block: table_of_contents

 

 

 

Untitled

 

Pythonでは,Python自体のバージョンはmiseで管理.(pyenvは不要)

グローバルにはmise use -g python,プロジェクトごとでは -gオプションなしで.

プロジェクトの.tool-versionsファイルにinstallすると書かれる.そして mise install でそこの内容を全てインストールできる(pip install -r requirements.txtと同じ感覚)

 

パッケージはvenv (pythonインストール時にvenvは一緒にあるらしい)で管理.

venvは py -m venv .venvで作ってsource .venv/bin/activate する(プロンプトに.venv表示される).venv使わない場合はdeactivateしてグローバル化する.

 

 

 

Unsupported Block: heading_2

https://www.python.jp/install/windows/venv.html

https://www.youtube.com/watch?app=desktop&v=r4SkIhQThe0&ab_channel=PythonプログラミングVTuberサプー this is newer than the above.

https://qiita.com/bluesDD/items/b7c56d6d7ecf2b300314#7-仮想環境を削除する

Unsupported Block: toggle

py -m venv {virtual-env-name( .venv etc )}

-m means execute python-module

source {virtual-env-name}/bin/activate

activate the virtual-env

Unsupported Block: heading_2

https://www.youtube.com/watch?app=desktop&v=r4SkIhQThe0&ab_channel=PythonプログラミングVTuberサプー

Unsupported Block: toggle

pyenv install —list

list up all versions available by pyenv

pyenv install {specified verision}

pyenv versions

list up installed versions

pyenv global {specified version}

activate specified python version

 

when you can’t change python version

→ use ‘where pyenv’ instead of ‘which pyenv’ (if which pyenv shows shell-function)

https://qiita.com/ShiroUz/items/7e037a6f482ddf742834

https://hitori-sekai.com/python/error-pyenv/#google_vignette

https://qiita.com/lvn-awano/items/f6c313bddaa02a8d2e22

 

 

 

 

 

 

Unsupported Block: unsupported

>> back to All Articles

breadcrumb予定地
profileCard予定地

SideBarPage

共有ボタン予定地
他ボタン予定地