报错:
No module named verificateCodeSendingSMS less... (Ctrl+F1) This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are
解决:
在pycharm中设置source路径
file–>setting–>project:server–>project structure
将放package的文件夹设置为source,这样import的模块类等,就是通过这些source文件夹作为根路径来查找,也就是在这些source文件夹中查找import的东西。
例子:
有一个程序verificateCodeSendingSMS.py文件
def testPrint():
print('你好')
print('000000000')
if __name__ == '__main__':
print('啊发发')
另一个程序callFucntion.py调用上一个程序
import verificateCodeSendingSMS
def testCallFunction():
print('调用发短信的函数')
verificateCodeSendingSMS.testPrint()
testCallFunction()
输出结果:
000000000
调用发短信的函数
你好
网友评论