I've created a virtual environment using both virtualenv and pipenv and in the both cases it seems that sphinx is not able to figure out the correct Python version. I have installed Python 2.7 and Python 3.8 in my global environment.
The error shows up when I try to use sphinx-apidoc + make html. I'm on a Windows 10 machine. Because I'm using type annotations, I get this error:
(venv) C:\Users\eug\Documents\learning\learning-pdoc\docs>make html
Running Sphinx v1.8.5
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 3 source files that are out of date
updating environment: 3 added, 0 changed, 0 removed
reading sources... [100%] sample_package
WARNING: autodoc: failed to import module u'core' from module u'sample_package'; the following exception was raised:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\sphinx\ext\autodoc\importer.py", line 154, in import_module
    __import__(modname)
  File "C:\Users\eug\Documents\learning\learning-pdoc\sample_package\core.py", line 4
    def sample_function2(a : Number, b : Number)->Number:
                           ^
SyntaxError: invalid syntax
As you can see I'm currently on the virtual environment (venv). Calling python by itself correctly calls the right version. In order to execute what I want I need to call:
python -m sphinx.cmd.build -M html . .
Which is not ideal. Is there a way to fix this?
 
    