1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pixi(Rust で書かれたパッケージマネージャー)を Mac と Windows で導入して Mac で軽く試す: numpy と matplotlib を扱う

1
Posted at

はじめに

この記事は、Rust で書かれたパッケージマネージャーである「pixi」に関する話です。

●Home
 https://pixi.prefix.dev/latest/

2026-06-25_23-42-54.jpg

●prefix-dev/pixi: Powerful system-level package manager for Linux, macOS and Windows written in Rust – building on top of the Conda ecosystem.
 https://github.com/prefix-dev/pixi

2026-06-25_23-43-10.jpg

pixi と他のツールとの比較

pixi と他のツールとの比較は、pixi のページに以下の表で示されています。

2026-06-25_23-53-13.jpg

導入方法

自分の Mac・Windows の、それぞれの環境に導入してみます。

Mac での導入方法

Mac での pixi の導入方法はいくつかあるようですが、自分は Homebrew を使いました。

●Homebrew Formulae: pixi
 https://formulae.brew.sh/formula/pixi

2026-06-25_23-44-51.jpg

具体的には、以下のコマンドを使いました。

brew install pixi

以下のように、インストール後に pixi コマンドが使えるようになったことも確認できました。

2026-06-25_23-50-08.jpg

Windows での導入方法

Windows での pixi の導入方法もいくつかあるようですが、自分は Winget を使いました。

●Installation - Pixi
 https://pixi.prefix.dev/latest/installation/#winget

2026-06-25_23-47-33.jpg

具体的には、以下のコマンドです。

winget install prefix-dev.pixi

軽く試してみる

あとは軽く試してみます。

Mac の環境で試してみる

Mac の環境で試してみます。

下準備

まずは下準備で、以下のコマンドで Python のコードを書く前までの内容を進めます。

mkdir python-plot-test
cd python-plot-test

pixi init
pixi add python numpy matplotlib
pixi run python --version

上記の内容を実行した結果は、以下のとおりです。

2026-06-25_23-56-47.jpg

次に Python のコードを書いていきます。

Python のコード

今回のお試し用の Python のコードは以下のようなシンプルなものにしました。
(ファイル名は plot.py にしました)

plot.py
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 2 * np.pi, 100)
y = np.sin(x)

plt.plot(x, y)
plt.title("sin curve")
plt.xlabel("x")
plt.ylabel("sin(x)")
plt.grid(True)
plt.show()

Python のコードを pixi コマンドで実行する

あとは、これを pixi コマンドで実行します。具体的には以下のとおりです。

pixi run python plot.py

上記を実行することで、以下のようにグラフ表示が行えることを確認できました。

2026-06-25_23-59-59.jpg

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?