当尝试使用Git Bash在Windows 10上运行Python 3.7时,出现以下错误:
// your original, parsed Array:
let words = ["color", "blue", "font-size", "100px"],
// we convert your array of words into a two-dimensional Array
// word-pairs, using Array.prototype.reduce():
// (Please note this approach was taken from user
// Vbyec's answer: https://stackoverflow.com/a/44996257/82548)
pairs = words.reduce(function(result, value, index, array) {
// if the index modulo 2 (the remainder of the index divided by 2)
// is equal to 0:
if (index % 2 === 0)
// we push the sliced Array elements - taken from the copy
// of the Array - into the result Array (the empty Array
// passed as an argument):
result.push(
// here we define the start of the slice as the index
// of the current Array-element and the end of the
// slice before the element found at the index of
// index of the current Array-element + 2:
array.slice(index, index + 2)
);
// we then return the result:
return result;
}, []),
// we use Object.fromEntries() to create a new Object from
// the two-dimensional Array we created:
cssObj = Object.fromEntries(pairs);
// we pass the created-Object to jQuery's css() method:
$('#myid').css(cssObj);
该怎么办?
编辑:我通过使用scoop安装python并使用cmder而不是Git Bash安装了python,从而解决了(或更避免了)。
答案 0 :(得分:2)
实际上没有安装Python。那是一个可以打开Windows应用商店的填充程序,但是它只能在PowerShell或CMD中运行(并且有时只能正确运行)。我建议访问Python网站并从那里下载并安装。
以下是宣布此“功能”的博客文章:https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/
这篇超级用户文章讨论了解决方案: https://superuser.com/questions/1437590/typing-python-on-windows-10-version-1903-command-prompt-opens-microsoft-stor