ModuleNotFoundError: Python 3.6 does not find modules, while Python 3.5 does

I wanted to upgrade the python version from 3.5 to 3.6. Since I use WinPython , I downloaded and installed the latest version, as before, with version 3.5.

However, if I use version 3.6, I get it ModuleNotFoundErrorwhenever I import the created module itself. Minimal example: I created a file t1.pycontaining only the operator passand a file t2.pycontaining the following code:

import t1
print("done")

Both files are in the same folder D:\MyProject\src. Now when I run the file with python 3.5, everything works fine:

'C:\Program Files\WinPython-64bit-3.5.1.2\python-3.5.1.amd64\python.exe' D:\MyProject\src\t2.py
done

However, with python 3.6 I get

'C:\Program Files\WinPython-64bit-3.6.0.1Qt5\python-3.6.0.amd64\python.exe' D:\MyProject\src\t2.py
Traceback (most recent call last):
  File "D:\MyProject\src\t2.py", line 6, in <module>
    import t1
ModuleNotFoundError: No module named 't1'

I ran out of ideas about what could be a problem and would appreciate a new inspiration.

+6
1

? t2.py

import os
__path__=[os.path.dirname(os.path.abspath(__file__))]
from . import t1
print("t2 done")

Python-3.6 "python._pth" python.exe( "pyvenv.cfg" )

, "D:\MyProject\src" Python._pth python._pth. :

python36.zip
DLLs
Lib
.
..\test
import site

" http://bugs.python.org/issue29578?@ok_message=msg%20287921%20created%0Aissue%2029578%20message_count%2C%20messages%20edited%20ok&@template=item"

, , python: "python._pth" "python.exe", "pythonzz._pth"

Python "Windows" , Python-3.6.0.

+8

Source: https://habr.com/ru/post/1015020/


All Articles