Tutorial 5 - Installing our pip package

In this tutorial we will use virtualenv with 3ds Max. The virtualenv tool allows us to configure different independent Python execution environments on our machine, each having its own set of installed pip packages.

The complete documentation for virtualenv can be found here

Create and Activate a Virtual Environment

The Python embedded with 3ds Max includes the virtualenv tool, and we will be using that. Open a command prompt in the 3ds Max Python directory (typically something like C:\Program Files\Autodesk\3ds Max 202X\Python37) and create a virtual environment:

python -m virtualenv d:\myenv

Then activate it by running:

d:\myenv\Scripts\activate

Note: It is important to start 3ds Max from this same command prompt that was used to activate the virtual environment, as that command sets up some environment variables that 3ds Max will detect.

Start 3ds Max:

3dsmaxs -python3

From this moment we can use pip to add packages inside the virtual environment:

pip install somepackage

And we are able to import the installed package in 3ds Max:

import somepackgage