小编ada*_*mgy的帖子

npm 安装时 Mac 上的 inotify@1.4.6 平台不受支持

我正在尝试建立一个反应项目。但是,当我运行 npm install 时,它会抛出此错误:

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for inotify@1.4.6: wanted {"os":"linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm ERR! notsup Valid OS:    linux
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   darwin
npm ERR! notsup Actual Arch: x64 
Run Code Online (Sandbox Code Playgroud)

显然,我的 Mac 似乎不支持这个库。我希望一些解决方法可以解决这个问题,而不是删除这个库。请建议我如何解决这个问题。

macos npm node-modules reactjs

5
推荐指数
1
解决办法
1648
查看次数

可选参数 Python

必须编写一些代码来定义一个可以使用两个或三个参数的函数。

该函数应采用三个参数:

  • 温度,浮动
  • 天气,字符串
  • is_celsius,一个布尔值

如果温度低于冰点(如果 is_celsius 为 False,则为 32,如果 is_celsius 为 True,则该函数应返回 True)或天气“下雪”。否则,它应该返回 False。

但是请注意, is_celsius 应该是一个可选参数。如果函数调用没有为 is_celsius 提供值,则假定它为 True。

我写了这个

def snowed_in(temperature, weather, **cels):
    if weather =="snowy":
        return True
    elif weather=="sunny":
        if 'is_celsius = False' in cels:
            if temperature<32:
                return True
    elif 'is_celsius = True' in cels:
        if temperature<0:
            print ('ad')    
            return True
    elif 'is_celsius = True' not in cels:
        if temperature<0:
            return True
    else:
        return False
Run Code Online (Sandbox Code Playgroud)

以及以下电话

print(snowed_in(15, "sunny")) #Should print False
print(snowed_in(15, "sunny",is_celsius = False)) #Should …
Run Code Online (Sandbox Code Playgroud)

python debugging arguments optional

4
推荐指数
1
解决办法
6100
查看次数

标签 统计

arguments ×1

debugging ×1

macos ×1

node-modules ×1

npm ×1

optional ×1

python ×1

reactjs ×1