pycharm in from, import file / module problems

1 references a local file

As shown above, there may be cited in pycharm, the .py file when local project folder there is a problem, then we need to consider whether the project is an IDE environment is not set to the path environment variable reference, there are about a few method can be solved:
1. in this case can sys.path.insert () statement, the file path of the local file need to be introduced as a parameter passed to a function, which can eliminate the wavy line in FIG. (Can be added to the project file is not in the same directory as the file)
2 . PYTHONPATH by the method Here Insert Picture Descriptionhere will add a path that enables IDE access available.
3 . Select the target file by right-click the folder where, as shown in Fig mark directory as you can see below in the presence of options
Here Insert Picture Descriptionexist excluded, select this solve the problem, if you still have problems you can try a few remaining . After selecting the end of the need to wait a few seconds to change pending the environment settings in order to eliminate error wavy lines.
Here Insert Picture Description

Module 2 has introduced problems

There are mostly imported modules and environmental issues do not exist in this module are related, you can open the operating environment in setting settings to see whether this module, if required version can find out whether there is a problem, do not meet the requirements, then reinstall Dafa is good, there is a problem you can try reloading.

Released four original articles · won praise 1 · views 80

Guess you like

Origin blog.csdn.net/qq_37086224/article/details/104682325