首页 > 解决方案 > 问题 /bin/sh: 0: Illegal option -* running code in python3

问题描述

在 UTF8 中配置的错误图像和编辑器 我正在尝试在 python 3.7.5 中运行以下代码

pi = 3.14159
radius = 15.3
print ('Circle Area is', pi * radius ** 2)

不运行错误出现:SyntaxError: Non-ASCII character '\ xc3' in file

添加命令行#! - * - conding: utf8 - * -出现以下错误:

/ bin / sh: 0: Illegal option - *

标签: python-3.x

解决方案


它应该没有空格,也不是conding它的coding

# -*- coding: utf-8 -*-

不是

 #! - * - conding: utf8 - * - 

推荐阅读