当前位置:网站首页>No such file or directory: ‘/tmp/tmpxxx/tmpxxx.py‘
No such file or directory: ‘/tmp/tmpxxx/tmpxxx.py‘
2022-07-02 15:28:00 【Coding的叶子】
在运行python程序过程中,“No such file or directory” 是个经常容易出现的错误。这个错误比较常见的原因是路径下缺乏相应的文件,或者缺少相应的python库。解决方法主要是在:
(1)在路径下添加缺失的文件或目录。
(2)在程序中通过sys.path.append增加文件或目录所在路径。
(3)通过pip安装缺失的库。
但是,以上所述的情况都不能解决本文所说的错误。我们可以看到,提示的确实文件是在tmp文件夹下,说明该文件是一个临时文件。临时文件一般是python运行是自动产生并清除的。因此,我们是无法找到对应的文件路径,因为这个文件路径是随时可变的。每运行一次,又会在tmp文件夹下产生一个随机名称的文件夹。
详细的错误提示如下所示:
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/tmpn673osmy/tmph_33a_ku.py", line 26, in <module>
lib/python3.7/tempfile.py", line 444, in close
unlink(self.name)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpn673osmy/tmph_33a_ku.py'
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/tmpn673osmy/tmph_33a_ku.py", line 26, in <module>
lib/python3.7/tempfile.py", line 444, in close
unlink(self.name)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpn673osmy/tmph_33a_ku.py'
一般造成这个错误的一种可能的原因是相关python文件出现了语法错误。以在mmclassification中文件为例,除了提示该错误之外,在错误信息之前还提到了config.py文件,以及错误NameError: name 'dataset_type' is not defined。因此,问题出现在config.py相关文件,并不一定是config.py自身。
在mmclassification中,config.py是框架自身的文件,不存在语法错误。经检查发现,是自己定义的数据配置文件缺少了datase_type的定义。修复该问题之后,原来的tmp文件缺失错误也得到了修复。
更多三维、二维感知算法和金融量化分析算法请关注“乐乐感知学堂”微信公众号,并将持续进行更新。
边栏推荐
- executescalar mysql_ExecuteScalar()
- 常用SQL语句(完整范例)
- ssb门限_SSB调制「建议收藏」
- ROS knowledge point - message_filters
- Si446 usage record (I): basic data acquisition
- 微信小程序 —— 上下浮动的箭头
- The bottom simulation implementation of vector
- uniapp H5页面调用微信支付
- 书包网小说多线程爬虫[通俗易懂]
- 2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition (a sign in, B sign in, C sign in, D thinking +mst
猜你喜欢
HBuilderX运行到手机或模拟器提示没有找到设备
Platform management background and business menu resource management: business permissions and menu resource management design
Microservice architecture practice: Construction of highly available distributed file system fastdfs architecture
TCP congestion control details | 2 background
Smart trash can (V) - light up OLED
RK1126平台项目总结
VirtualLab基础实验教程-7.偏振(1)
easyswoole3.2重启不成功
【目标跟踪】|SiamFC
chrome瀏覽器快速訪問stackoverflow
随机推荐
Sword finger offer 24 Reverse linked list
牛客 JS3 分隔符
海思Hi3798MV100机顶盒芯片介绍[通俗易懂]
From collection to output: inventory those powerful knowledge management tools - inventory of excellent note taking software (4)
uva1169
Nexus簡介及小白使用IDEA打包上傳到Nexus3私服詳細教程
List summation [dummy+ tail interpolation + function processing list reference common pit]
When the industrial Internet began to enter the deep-water area, it appeared more in the form of industry
Navigateur Chrome pour un accès rapide au stackoverflow
Meanings of SNAT, DNAT and masquerade in iptables
JS20 array flattening
13、Darknet YOLO3
Niuke JS2 file extension
从收集到输出:盘点那些强大的知识管理工具——优秀笔记软件盘点(四)
871. Minimum refueling times
em120.gige.h
Leetcode question brushing record | 933_ Recent requests
After meeting a full stack developer from Tencent, I saw what it means to be proficient in MySQL tuning
Niuke js3 separator
常用SQL语句(完整范例)