解决Python 文件名与模块名字冲突问题!!!!!!!!!!!!

在部署cerlery (芹菜)这玩意  ,有个cerlery.py 文件老报错,,,,找不到模块、经过分析以后,

这不是模块冲突了吗

奉劝大家,不要这么干,自己写的程序 名字 ,不要写成与模块同名,还要引入这个模块!!

但是还好有解决方法:

1 说了相当于白说

把自己文件名字更换

 

2 重点来了

import sys
_cpath_ = sys.path[0] #获取当前路径
sys.path.remove(_cpath_) #删除
from jira import JIRA
sys.path.insert(0, _cpath_) #恢复

sys.path.remove(_cpath_) #删除 这一条可以将path中的第一条删除
sys.path.insert(0, _cpath_) #恢复这一条可以将path恢复成原来的样子

程序总是将上级目录内容定位最高优先级,只要将它暂时屏蔽掉就可以了

 

在你的问题,出现了一个错误信息:AttributeError: module 'numpy' has no attribute 'int'。这个错误通常表示在使用numpy模块时,尝试调用'int'属性时出错。根据引用提供的信息,我可以给出两种可能的解决方法。 第一种方法是手动安装该模块。你可以使用命令行或终端窗口运行以下命令进行安装: ```python pip install numpy ``` 这将下载并安装numpy模块。安装完成后,你可以在代码引入numpy模块并使用'int'属性。 第二种方法是检查文件名。根据引用提供的信息,这种错误有时是因为文件名与要使用的模块导致的。请确保你的文件名不与numpy模块冲突。 通过以上两种方法之一,你应该能够解决该错误。希望对你有所帮助!<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [python报错: list object has no attribute shape的解决](https://download.csdn.net/download/weixin_38748721/13708867)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [关于python:AttributeError: module 'xxx' has no attribute 'xxx'的错误解决](https://blog.csdn.net/weixin_35737303/article/details/80203586)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值