ImportError: No module named utils
[root@trcloud-gtt-dw python]cat email.py
import smtplib
print 'aaa'
[root@trcloud-gtt-dw python]# python email.py
aaa
Traceback (most recent call last):
File "email.py", line 3, in
import smtplib
File "/usr/lib64/python2.6/smtplib.py", line 46, in
import email.utils
ImportError: No module named utils
一個簡單的語句報錯原因是因為檔名email.py和module名重複了,python會優先呼叫當前path上的,修改掉email.py就可以了
import smtplib
print 'aaa'
[root@trcloud-gtt-dw python]# python email.py
aaa
Traceback (most recent call last):
File "email.py", line 3, in
import smtplib
File "/usr/lib64/python2.6/smtplib.py", line 46, in
import email.utils
ImportError: No module named utils
一個簡單的語句報錯原因是因為檔名email.py和module名重複了,python會優先呼叫當前path上的,修改掉email.py就可以了
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29989552/viewspace-2129858/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ImportError: No module named `defusedxml`ImportErrorXML
- ImportError: No module named yamlImportErrorYAML
- ImportError: No module named cElementTreeImportError
- ImportError: No module named torchvisionImportError
- ImportError: No module named builtinsImportErrorUI
- ImportError: No module named ‘torch‘ 解決方法ImportError
- ImportError:No module named SCons.ScriptImportError
- ImportError: No module named setuptools 解決方法ImportError
- ImportError: No module named thrift.Thrift問題解決ImportError
- pip安裝錯誤:ImportError: No module named 'pkg_resources'ImportError
- 啟動uwsgi報錯ImportError: No module named, unable to load appImportErrorAPP
- media-dispatcher啟動時報ImportError: No module named application.processImportErrorAPP
- pyecharts安裝後import錯誤 ImportError: No module named 'pyecharts_snapshot'EchartsImportError
- Window7 python2.7 拋錯ImportError No module named mysql.connectorPythonImportErrorMySql
- ImportError: No module named flask 導包失敗,Python3 重新安裝 Flask 模組ImportErrorFlaskPython
- pycharm環境,命令列執行提示:ImportError: No module named xxx 解決方法PyCharm命令列ImportError
- ModuleNotFoundError: No module named 'sqlite'ErrorSQLite
- ModuleNotFoundError: No module named 'pyttsx'ErrorTTS
- ModuleNotFoundError: No module named ‘Crypto‘ ‘Cryptodome‘Error
- linux已經安裝bert4keras但出現ImportError: No module named ‘bert4keras‘LinuxKerasImportError
- ModuleNotFoundError: No module named 'phkit.pinyin'Error
- No module named MYSQLdb 問題解決MySql
- ModuleNotFoundError: No module named ‘DBUtils‘解決辦法Error
- Linux:Python報錯:No module named MySQLdbLinuxPythonMySql
- ModuleNotFoundError: No module named ‘cv2’——(版本問題)Error
- python ModuleNotFoundError: No module named ‘requests‘ 的 解決方案PythonError
- ImportError: cannot import name 'get_ora_doc' from partially initialized moduleImportErrorZed
- 使用PyCharm時顯示的 No module named ‘xxx’PyCharm
- 【已解決】ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.ImportError
- yum依賴python2環境-"No module named urlgrabber"Python
- 解決Python找不到ssl模組問題 No module named _sslPython
- Scrapy學習中解決No module named tutorial.items問題
- ModuleNotFoundError: No module named ‘matplotlib‘ 一系列解決辦法Error
- kafka.utils.Utils閱讀Kafka
- 問題結局辦法:Error loading psycopg2 module: No module named ‘psycopg2‘Error
- 使用Pycharm出現No module named Test_01_module_a less... (Ctrl+F1) This inspection detects names that shPyCharm
- 解決:ModuleNotFoundError: No module named ‘urllib3.packages.six.moves問題ErrorPackage
- java utilsJava