Implementing Monte-Carlo-based π estimation as a Python module.
It is highly recommended to build and run this code in a Python virtual environment. The easiest way is to use the Anaconda distribution, but you can use your preinstalled Python interpreter, also.
-
Install Anaconda
-
In the command prompt (Anaconca Prompt on Windows), create a new virtual environment (with some key packages installed):
conda create -n py_pi python jupyter numpy maturin
- Activate your environment
conda activate py_pi
- Build (release profile) and install this package in your virtual environment
maturin develop -r
- Launch Jupyter Lab, and open the
experiment.ipynb
notebook in your browser. Play with it.
jupyter lab
Needs at least Python 3.7.
- In the command prompt, create a new virtual environment:
python3 -m venv .venv
-
Activate your environment
- On macOS/Linux:
source .venv/bin/activate
- On Windows:
.\Scripts\activate.bat
-
Install required Python packages
pip install jupyter numpy maturin
- Build (release profile) and install this package in your virtual environment
maturin develop -r
- Launch Jupyter Lab, and open the
experiment.ipynb
notebook in your browser. Play with it.
jupyter lab