terminal

Switch between python 2.7 and python 3.5 on Mac OS X

断了今生、忘了曾经 提交于 2019-12-17 10:23:42
问题 I generally use Python 2.7 but recently installed Python 3.5 using Miniconda on Mac OS X. Different libraries have been installed for these two versions of python. Now, the entering either of the keywords 'python' or 'python3' in terminal invokes python 3.5, and 'python2' returns '-bash: python2: command not found'. How can I now invoke them specifically using aliases 'python2' and 'python3' respectively? I am currently using OS X El Capitan. 回答1: IMHO, the best way to use two different

Bower: Install 2 versions of jQuery

ε祈祈猫儿з 提交于 2019-12-17 10:11:52
问题 How would I go about installing 2 versions of jQuery using bower ? I want to have v2.0 as well as 1.9.1 for browser support fallback The issue I'm having is that if you run bower install jquery#1.9.1 jquery#2.0.0 the first version gets overwritten by the second because they are the same component 回答1: In the dependencies part of your bower.json you can have something like this: "dependencies": { "jquery": "2.0.0", "jquery-1.9.1": "http://code.jquery.com/jquery-1.9.1.js" } One shouldn't

Scrolling inside Vim in Mac's Terminal

心已入冬 提交于 2019-12-17 10:07:56
问题 I've been googling around trying to figure out if it's possible to use my mouse wheel to scroll while inside Vim in Mac's Terminal, with no luck. It seems as if only X11 or iTerm support this. Before I give up, I thought I'd try the geniuses here to see if anyone knows a way to do this. So, does anyone know if I can set that up? Or should I seriously consider using a different terminal application? 回答1: http://bitheap.org/mouseterm/ Use MouseTerm (and do make sure to install SIMBL first!) and

input(): “NameError: name 'n' is not defined” [duplicate]

隐身守侯 提交于 2019-12-17 09:58:48
问题 This question already has answers here : input() error - NameError: name '…' is not defined (12 answers) Closed 3 years ago . Ok, so I'm writing a grade checking code in python and my code is: unit3Done = str(input("Have you done your Unit 3 Controlled Assessment? (Type y or n): ")).lower() if unit3Done == "y": pass elif unit3Done == "n": print "Sorry. You must have done at least one unit to calculate what you need for an A*" else: print "Sorry. That's not a valid answer." When I run it

Zipalign - Command not found - MAC terminal

别等时光非礼了梦想. 提交于 2019-12-17 08:54:46
问题 When I try to run Zipalign on an apk I get the error "Command not found" I am not that familiar with using terminal commands on the MAC but I have navigated to the SDK/Tools folder and run the following command: zipalign -v 4 Project1.apk Project1-aligned.apk I get Command not found I have tried placing the apks in the Tools folder and same result. Can someone help me to understand where the apks should be located and where I should run zipalign from? Thanks, I am very frustrated about this

Is there go up line character? (Opposite of \n)

牧云@^-^@ 提交于 2019-12-17 08:52:54
问题 I would like to overwrite something on a line above in in a serial console. Is there a character that allows me to move up? Thank you. 回答1: Most terminals understand ANSI escape codes. The relevant codes for this use case: "\033[F" – move cursor to the beginning of the previous line "\033[A" – move cursor up one line Example (Python): print("\033[FMy text overwriting the previous line.") 回答2: No, not really easily, for that you'd have to use something like the curses library, especially if

Is there go up line character? (Opposite of \n)

被刻印的时光 ゝ 提交于 2019-12-17 08:52:10
问题 I would like to overwrite something on a line above in in a serial console. Is there a character that allows me to move up? Thank you. 回答1: Most terminals understand ANSI escape codes. The relevant codes for this use case: "\033[F" – move cursor to the beginning of the previous line "\033[A" – move cursor up one line Example (Python): print("\033[FMy text overwriting the previous line.") 回答2: No, not really easily, for that you'd have to use something like the curses library, especially if

Python Script execute commands in Terminal

﹥>﹥吖頭↗ 提交于 2019-12-17 08:05:38
问题 I read this somewhere a while ago but cant seem to find it. I am trying to find a command that will execute commands in the terminal and then output the result. For example: the script will be: command 'ls -l' It will out the result of running that command in the terminal 回答1: There are several ways to do this: A simple way is using the os module: import os os.system("ls -l") More complex things can be achieved with the subprocess module: for example: import subprocess test = subprocess.Popen

Octave-Gnuplot-AquaTerm error: set terminal aqua enhanced title “Figure 1”…unknown terminal type"

大憨熊 提交于 2019-12-17 08:02:30
问题 I've installed Octave and gnuplot via Homebrew, and downloaded AquaTerm.dmg. When I try to plot, I get the following message: octave:4> plot(x,y) gnuplot> set terminal aqua enhanced title "Figure 1" font "*,6" ^ `line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list` In a bash terminal set terminal , set Terminal , set term , (and the same, followed by "aqua" too) etc gives nothing. I've tried plotting again from octave having the "AquaTerm" already open, but nothing

How to Batch Rename Files in a macOS Terminal?

你。 提交于 2019-12-17 08:01:32
问题 I have a folder with a series of files named: prefix_1234_567.png prefix_abcd_efg.png I'd like to batch remove one underscore and the middle content so the output would be: prefix_567.png prefix_efg.png Relevant but not completely explanatory: How can I batch rename files using the Terminal? Regex to batch rename files in OS X Terminal 回答1: In your specific case you can use the following bash command ( bash is the default shell on macOS): for f in *.png; do echo mv "$f" "${f/_*_/_}"; done