Search code examples
pythonmacospackageversion

How macOS Monterey install newest version of motor package for python?


My python project cannot work because of the motor package's version is 2.3.0 and only version up to 3.3.1 can work. I tried download .wl and sudo pip install these higher versions but they could't work. I guess the reason is the macOS12 cannot install higher versions of motor.

My mac is air2017, keep in macOS Monterey and cannot upgrade the system anymore. the question sames to those packages like ipython, aiohttp, aiomysql.


Solution

  • You're likely running an older version of Python. You can download a newer version from here. I would recommend the latest stable version 3.12. After running the package installer, you can then install the latest version of a package with

    python3.12 -m pip install motor
    

    or a specific version with

    python3.12 -m pip install motor==3.3.1
    

    I was able to install motor 3.4.0 and 3.3.1 on an even older version of macOS-Big Sur. Just remember to run your program using the same Python version.

    If that doesn't work, you can always download the source directly (either from that same page, or the GitHub) and then either add that to your system path or work inside the directory for a quick test.