pyhton invalid syntax
时间: 2023-10-17 07:35:55 浏览: 161
Python常用单词.docx
当在Python中引入带有横杠的模块时,会出现"invalid syntax"的错误。这是因为Python中的标识符不能包含横杠,而模块名称中通常会使用横杠。为了解决这个问题,我们可以将横杠替换为下划线,即将模块名称中的横杠位置从中间移动到底部。例如,将"en-core-web-sm"变为"en_core_web_sm"。这样,在引入模块时就不会出现语法错误了。
参考:https://stackoverflow.com/questions/54334304/spacy-cant-find-model-en-core-web-sm-on-windows-10-and-python-3-5-3-anacon <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [python中引入名称中带有横杠模块的时候出现:SyntaxError: invalid syntax](https://blog.csdn.net/jiuweideqixu/article/details/109449371)[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: 33.333333333333336%"]
- *2* [python学习笔记之调用eval函数出现invalid syntax错误问题](https://download.csdn.net/download/weixin_38690095/12875994)[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: 33.333333333333336%"]
- *3* [Pyhton F字符串引起的invalid syntax](https://blog.csdn.net/qq_26235879/article/details/108635219)[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: 33.333333333333336%"]
[ .reference_list ]
阅读全文