Question: I want to install some third-party Python modules for QGIS 3 on Mac, however, I have no clue how to do it, since I am not so much familiar with different Python environments.

Is there any similar thing to the OSGeo4W Shell on Mac, or is it possible to do via the terminal?

Answer: 
from [Download for Macos](https://qgis.org/en/site/forusers/download.html)

> 
> These packages use the python.org Python 3, version 3.6, the "macosx10.9" build - other distributions are not supported. Install Python before installing QGIS.
> 
> 
> 

1) To know the python interpreter path used by QGIS 

In the Python console of QGIS

```
import sys
print(sys.executable)
/usr/local/bin/python3.6

```

2) then in the terminal

```
$ /usr/local/bin/python3.6
Python 3.6.8 
...
>>>

```

3) and you can install third-party Python modules from the terminal

```
/usr/local/python/bin/python3.6 -m pip install shapely

```

or 

```
/usr/local/bin/python3.6 setup.py install

```

### New

I cannot install the 3.10 version in my Mac, but if I examine the application file:

The content of /Applications/QGIS3.10.app/Contents/MacOS/

The QGIS executable is here

[![enter image description here](https://i.stack.imgur.com/8hxtA.png)](https://i.stack.imgur.com/8hxtA.png)

In the /Applications/QGIS3.10.app/Contents/MacOS/bin folder

[![enter image description here](https://i.stack.imgur.com/gekVS.png)](https://i.stack.imgur.com/gekVS.png)

There is a symbolic link file python3 that points to /Applications/QGIS3.10.app/QGIS3.10.app/Contents/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

[![enter image description here](https://i.stack.imgur.com/DC1Yp.png)](https://i.stack.imgur.com/DC1Yp.png)
Tested on QGIS 3.14 under MacOSX 10.15.

In QGIS, go to menu Settings > System and search for **Environment** options:

[![enter image description here](https://i.stack.imgur.com/0adWX.png)](https://i.stack.imgur.com/0adWX.png)

Check the `Use custom variables` checkbox, and :

* In the `Apply` column, choose `Append` ;
* In the `Variable` column, write `PYTHONPATH` ;
* In the `Value` column, write the path to the directory with python modules as `:/Users/me/Library/Python/3.8/lib/python/site-packages`

Beware, to correctly separate environment variables, don't forget the colon.

Restart QGIS and in the QGIS Python console, try to import your module.