Why can't I use apt-get on Mac even though wget is installed
macOS doesn't use apt as its package manager. Homebrew is the most popular package manager for macOS. Additionally, wget has no relation to the package manager, apt. See the awesome answer here for more information.
I would try this search for getting it ROS working with Mac. This SO question might be of relevance too.
How to get the mac terminal to be using UTF-8 encoding on the new macs?
.zshrc and .profile only exist if someone creates them. You do that in Terminal with
touch ~/.zshrc
touch ~/.profile
Check what shell you are using. In Terminalecho $SHELL
It is recommended to use the Z shell, you change this withchsh -s /bin/zsh
and then you need to restart Terminal for it to take effect. I think with the Z shell .profile may be ignored, and only .zshrc may be used.Quite likely there is no real change how the M1 Macs work compared to Intel Macs; you just created these files on your old Mac many years ago and have all forgotten about it.
Why do I get invalid syntax assigning local variables AFTER an IF statement in a function?
You get invalid syntax because Python, unlike other languages, utilizes space/tab to keep track of block of codes. A proper Python if
statement (with elif
) looks like so:
a = 10
if a == 0:
b = 10
elif a == 1:
b = 100
else:
b = 1000
elif
, as you might expect, requires an if
statement before it can be used. When you break the spacing:a = 10
if a == 0:
b = 10
a = 1
elif a == 1:
b = 100
else:
b = 1000
Python does not know where elif a == 1
is connected to, and thus gives you a syntax error. You likely meant:def isIn(char, aStr):
if len(aStr) <= 1 and char != aStr:
return False
HALF = len(aStr) // 2
# 'if', not 'elif' here.
if char == aStr[HALF]:
return True
elif char < aStr[HALF]:
return isIn(char, aStr[:HALF])
else:
return isIn(char, aStr[HALF:])
print(isIn('a', ''))
Related Topics
How to Align Gridlines for Two Y-Axis Scales Using Matplotlib
Numpy Argsort - What Is It Doing
Python Memory Usage of Numpy Arrays
Using Python Requests: Sessions, Cookies, and Post
How to Specify Python Version Used to Create Virtual Environment
Reading Binary Data from Stdin
What Is the Purpose of Flask's Context Stacks
How to Get Tweets Older Than a Week (Using Tweepy or Other Python Libraries)
Destructuring-Bind Dictionary Contents
How to Check If Stdin Has Some Data
How to Avoid Infinite Recursion with Super()
Overflowerror: (34, 'Result Too Large')
How to Combine Multiple Rows into a Single Row with Pandas
Multiple Plots in One Figure in Python