Python3.6.4 import file reporting module does not exist

such a simple folder with c7 and c8 files in the same folder.
clipboard.png


c7

clipboard.png

clipboard.png

clipboard.png

I think it"s the environment, but you can"t find it. Other normal runs are good

Apr.11,2021
For

PyCharm , you can see this How do I import modules in pycharm?


.

there are two solutions

  1. set the python running directory to the same directory as c7.py ( C:\ Users\ Administrator\ Desktop\ py\ ).
  2. add the directory where c7.py is located to the PYTHONPATH environment variable.

seems to have encountered this problem before, and then I had to add sys.path.append


at the beginning. For the problem of

relative path, you can set it this way. It can be used in both pycharm and cmd

.
import os
import sys

project_path = os.path.abspath(os.path.join('.'))
sys.path.append(project_path)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34b96-2bf1c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34b96-2bf1c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?