0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

久しぶりに作る Jupyter - uv

0
Posted at

こんにちは。

手元でデータ分析をしたいときに、いつも仮想環境を立ち上げるのが久しぶりになってしまうわたくしです。

uv を使って仮想環境を作る手順をメモしておきます。

uvがまだ入っていない場合

uvが入っていない方はこちら
brew install uv
uv --versionuv 

プロジェクトを作って起動

まずプロジェクト用のフォルダを作って入る
mkdir xxx
cd xxx
仮想環境を作る
# バージョンの指定があるときは --python をつける
uv venv [--python 3.xx]

仮想環境を有効化

一度作ったプロジェクトを再度立ち上げるときは、プロジェクトのフォルダに入ってこれをたたく

仮想環境を有効化
source .venv/bin/activate

使いたいライブラリを入れる

Jupyter を入れたい場合
uv pip install jupyter
# はやい!!

Jupyter を起動

Jupyter notebook を起動
jupyter notebook
# この動作がさほど速いってわけじゃない

やぁ、久しぶり!
image.png

作業中にライブラリを入れたくなったら、セル上で普通の %pip install xxx を実行する。

⬆️uv じゃなくてOK

作業が終わったら

Ctrl + C で Jupyter を終了させる

仮想環境を停止
deactivate
# Good night
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?