Category Archives: How to Fix

Error report of xv6 operating system make Makefile:192 : * * solutions to receive comments before first target. Stop

Error report of xv6 operating system make Makefile:192 : * * solutions to receive comments before first target. Stop

Hello everyone, my name is Qi Guanjie (Q í Gu ā NJI é). I record the learning process in CSDN. Time flies and the future is promising. Come on ~ the blog address is Qi Guanjie’s blog, and the nickname of station B is Qi Guanjie , and the address is Qi Guanjie’s station B

This article is original for Qi Guanjie, please support the original, part of the platform has been stealing articles from bloggers!!!


   there are many small partners who often encounter errors when doing experiments with the xv6 operating system Makefile:192 : *** recipe commences before first target. Stop. , and then I don’t know where the error is. Here is a possible error reporting situation and the solution (at present, only this method is used to review the error reporting. If there are other errors, you can send a makefile file to have a look).

Here, I will review the contents of makefile for error reporting

OBJS = \
	bio.o\
	console.o\
	exec.o\
	file.o\
	fs.o\
	ide.o\
	ioapic.o\
	kalloc.o\
	kbd.o\
	lapic.o\
	log.o\
	main.o\
	mp.o\
	picirq.o\
	pipe.o\
	proc.o\
	sleeplock.o\
	spinlock.o\
	string.o\
	swtch.o\
	syscall.o\
	sysfile.o\
	sysproc.o\
	trapasm.o\
	trap.o\
	uart.o\
	vectors.o\
	vm.o\

# Cross-compiling (e.g., on Mac OS X)
# TOOLPREFIX = i386-jos-elf

# Using native tools (e.g., on X86 Linux)
#TOOLPREFIX = 

# Try to infer the correct TOOLPREFIX if not set
ifndef TOOLPREFIX
TOOLPREFIX := $(shell if i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
	then echo 'i386-jos-elf-'; \
	elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
	then echo ''; \
	else echo "***" 1>&2; \
	echo "*** Error: Couldn't find an i386-*-elf version of GCC/binutils." 1>&2; \
	echo "*** Is the directory with i386-jos-elf-gcc in your PATH?" 1>&2; \
	echo "*** If your i386-*-elf toolchain is installed with a command" 1>&2; \
	echo "*** prefix other than 'i386-jos-elf-', set your TOOLPREFIX" 1>&2; \
	echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
	echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \
	echo "***" 1>&2; exit 1; fi)
endif

# If the makefile can't find QEMU, specify its path here
# QEMU = qemu-system-i386

# Try to infer the correct QEMU
ifndef QEMU
QEMU = $(shell if which qemu > /dev/null; \
	then echo qemu; exit; \
	elif which qemu-system-i386 > /dev/null; \
	then echo qemu-system-i386; exit; \
	elif which qemu-system-x86_64 > /dev/null; \
	then echo qemu-system-x86_64; exit; \
	else \
	qemu=/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu; \
	if test -x $$qemu; then echo $$qemu; exit; fi; fi; \
	echo "***" 1>&2; \
	echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
	echo "*** Is the directory containing the qemu binary in your PATH" 1>&2; \
	echo "*** or have you tried setting the QEMU variable in Makefile?" 1>&2; \
	echo "***" 1>&2; exit 1)
endif

CC = $(TOOLPREFIX)gcc
AS = $(TOOLPREFIX)gas
LD = $(TOOLPREFIX)ld
OBJCOPY = $(TOOLPREFIX)objcopy
OBJDUMP = $(TOOLPREFIX)objdump
CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
ASFLAGS = -m32 -gdwarf-2 -Wa,-divide
# FreeBSD ld wants ``elf_i386_fbsd''
LDFLAGS += -m $(shell $(LD) -V | grep elf_i386 2>/dev/null | head -n 1)

# Disable PIE when possible (for Ubuntu 16.10 toolchain)
ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]no-pie'),)
CFLAGS += -fno-pie -no-pie
endif
ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]nopie'),)
CFLAGS += -fno-pie -nopie
endif

xv6.img: bootblock kernel
	dd if=/dev/zero of=xv6.img count=10000
	dd if=bootblock of=xv6.img conv=notrunc
	dd if=kernel of=xv6.img seek=1 conv=notrunc

xv6memfs.img: bootblock kernelmemfs
	dd if=/dev/zero of=xv6memfs.img count=10000
	dd if=bootblock of=xv6memfs.img conv=notrunc
	dd if=kernelmemfs of=xv6memfs.img seek=1 conv=notrunc

bootblock: bootasm.S bootmain.c
	$(CC) $(CFLAGS) -fno-pic -O -nostdinc -I. -c bootmain.c
	$(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c bootasm.S
	$(LD) $(LDFLAGS) -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o
	$(OBJDUMP) -S bootblock.o > bootblock.asm
	$(OBJCOPY) -S -O binary -j .text bootblock.o bootblock
	./sign.pl bootblock

entryother: entryother.S
	$(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c entryother.S
	$(LD) $(LDFLAGS) -N -e start -Ttext 0x7000 -o bootblockother.o entryother.o
	$(OBJCOPY) -S -O binary -j .text bootblockother.o entryother
	$(OBJDUMP) -S bootblockother.o > entryother.asm

initcode: initcode.S
	$(CC) $(CFLAGS) -nostdinc -I. -c initcode.S
	$(LD) $(LDFLAGS) -N -e start -Ttext 0 -o initcode.out initcode.o
	$(OBJCOPY) -S -O binary initcode.out initcode
	$(OBJDUMP) -S initcode.o > initcode.asm

kernel: $(OBJS) entry.o entryother initcode kernel.ld
	$(LD) $(LDFLAGS) -T kernel.ld -o kernel entry.o $(OBJS) -b binary initcode entryother
	$(OBJDUMP) -S kernel > kernel.asm
	$(OBJDUMP) -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym

# kernelmemfs is a copy of kernel that maintains the
# disk image in memory instead of writing to a disk.
# This is not so useful for testing persistent storage or
# exploring disk buffering implementations, but it is
# great for testing the kernel on real hardware without
# needing a scratch disk.
MEMFSOBJS = $(filter-out ide.o,$(OBJS)) memide.o
kernelmemfs: $(MEMFSOBJS) entry.o entryother initcode kernel.ld fs.img
	$(LD) $(LDFLAGS) -T kernel.ld -o kernelmemfs entry.o  $(MEMFSOBJS) -b binary initcode entryother fs.img
	$(OBJDUMP) -S kernelmemfs > kernelmemfs.asm
	$(OBJDUMP) -t kernelmemfs | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernelmemfs.sym

tags: $(OBJS) entryother.S _init
	etags *.S *.c

vectors.S: vectors.pl
	./vectors.pl > vectors.S

ULIB = ulib.o usys.o printf.o umalloc.o

_%: %.o $(ULIB)
	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^
	$(OBJDUMP) -S $@ > $*.asm
	$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym

_forktest: forktest.o $(ULIB)
	# forktest has less library code linked in - needs to be small
	# in order to be able to max out the proc table.
	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
	$(OBJDUMP) -S _forktest > forktest.asm

mkfs: mkfs.c fs.h
	gcc -Werror -Wall -o mkfs mkfs.c

# Prevent deletion of intermediate files, e.g. cat.o, after first build, so
# that disk image changes after first build are persistent until clean.  More
# details:
# http://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
.PRECIOUS: %.o

UPROGS=\
	_cat\
	_echo\
	_forktest\
	_grep\
	_init\
	_kill\
	_ln\
	_ls\
	_mkdir\
	_rm\
	_sh\
	_stressfs\
	_usertests\
	_wc\
	_zombie\
fs.img: mkfs README $(UPROGS)
	./mkfs fs.img README $(UPROGS)

-include *.d

clean: 
	rm -f *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
	*.o *.d *.asm *.sym vectors.S bootblock entryother \
	initcode initcode.out kernel xv6.img fs.img kernelmemfs \
	xv6memfs.img mkfs .gdbinit \
	$(UPROGS)

# make a printout
FILES = $(shell grep -v '^\#' runoff.list)
PRINT = runoff.list runoff.spec README toc.hdr toc.ftr $(FILES)

xv6.pdf: $(PRINT)
	./runoff
	ls -l xv6.pdf

print: xv6.pdf

# run in emulators

bochs : fs.img xv6.img
	if [ ! -e .bochsrc ]; then ln -s dot-bochsrc .bochsrc; fi
	bochs -q

# try to generate a unique GDB port
GDBPORT = $(shell expr `id -u` % 5000 + 25000)
# QEMU's gdb stub command line changed in 0.11
QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
	then echo "-gdb tcp::$(GDBPORT)"; \
	else echo "-s -p $(GDBPORT)"; fi)
ifndef CPUS
CPUS := 2
endif
QEMUOPTS = -drive file=fs.img,index=1,media=disk,format=raw -drive file=xv6.img,index=0,media=disk,format=raw -smp $(CPUS) -m 512 $(QEMUEXTRA)

qemu: fs.img xv6.img
	$(QEMU) -serial mon:stdio $(QEMUOPTS)

qemu-memfs: xv6memfs.img
	$(QEMU) -drive file=xv6memfs.img,index=0,media=disk,format=raw -smp $(CPUS) -m 256

qemu-nox: fs.img xv6.img
	$(QEMU) -nographic $(QEMUOPTS)

.gdbinit: .gdbinit.tmpl
	sed "s/localhost:1234/localhost:$(GDBPORT)/" < $^ > $@

qemu-gdb: fs.img xv6.img .gdbinit
	@echo "*** Now run 'gdb'." 1>&2
	$(QEMU) -serial mon:stdio $(QEMUOPTS) -S $(QEMUGDB)

qemu-nox-gdb: fs.img xv6.img .gdbinit
	@echo "*** Now run 'gdb'." 1>&2
	$(QEMU) -nographic $(QEMUOPTS) -S $(QEMUGDB)

# CUT HERE
# prepare dist for students
# after running make dist, probably want to
# rename it to rev0 or rev1 or so on and then
# check in that version.

EXTRA=\
	mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\
	ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\
	printf.c umalloc.c\
	README dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\
	.gdbinit.tmpl gdbutil\

dist:
	rm -rf dist
	mkdir dist
	for i in $(FILES); \
	do \
		grep -v PAGEBREAK $$i >dist/$$i; \
	done
	sed '/CUT HERE/,$$d' Makefile >dist/Makefile
	echo >dist/runoff.spec
	cp $(EXTRA) dist

dist-test:
	rm -rf dist
	make dist
	rm -rf dist-test
	mkdir dist-test
	cp dist/* dist-test
	cd dist-test; $(MAKE) print
	cd dist-test; $(MAKE) bochs || true
	cd dist-test; $(MAKE) qemu

# update this rule (change rev#) when it is time to
# make a new revision.
tar:
	rm -rf /tmp/xv6
	mkdir -p /tmp/xv6
	cp dist/* dist/.gdbinit.tmpl /tmp/xv6
	(cd /tmp; tar cf - xv6) | gzip >xv6-rev10.tar.gz  # the next one will be 10 (9/17)

.PHONY: dist-test dist

Solution: it’s actually very simple, because you’re in fs.img : a blank line is missing, which may be due to the careless deletion of the blank line during modification, resulting in his error. Add a blank line at the end of uprogs in the position shown in the figure.


Hello everyone, my name is Qi Guanjie (Q í Gu ā NJI é). I record the learning process in CSDN. Time flies and the future is promising. Come on ~ the blog address is Qi Guanjie’s blog, and the nickname of station B is Qi Guanjie , and the address is Qi Guanjie’s station B

This article is original for Qi Guanjie, please support the original, part of the platform has been stealing articles from bloggers!!!

Go run error go run: cannot run non main package

I was born in Java. Recently I became interested in go language, so I will learn it with go in the future.

After the go environment is installed and configured, the vscode development tool is installed, and the first go program is written. It’s very simple, just a simple output statement, but it does

Go run: cannot run non main package. The code is as follows:

package test
import "fmt"
func main() {
  fmt.Println("cainiaobulan testing go")
}

The error message of go is very straightforward. The main method can only be placed in package main. Go run is to execute the command and a main must be used to call it. Install can be directly compiled into a package file or an EXE (if there is a main function)

Change the code and run OK

package main
import "fmt"
func main() {
  fmt.Println("cainiaobulan testing go")
}

Just take this mistake as the first step for me to learn go. In the future, I can cross the pit step by step. I hope that children’s shoes with the same interest can learn together and carry forward go. At the same time, I also want to seek guidance from the boss. I am ready to develop in the direction of go web.

One of the common mistakes of tex

1: “Latex” is reported in compile! paragraph complete ended before \align was complete”,

Compile code:

\begin{align}\label{LL:01}
q_ s(o_ s(t))=(1+\phi_ s(t))o_ s(t) \\
\end{align}

\begin{align*}\label{LL:01}
q_ s(o_ s(t))=(1+\phi_ s(t))o_ s(t)
\end{align*}

Solution:

\Usepackage {amsmath}
is used in formula environment.

This example can be changed to:
– begin {equation} label {LL: 01}
– begin {aligned}

q_ s(o_ s(t))=(1+\phi_ s(t))o_ s(t) \\
\end{aligned}
\end{equation}

Effect of operation

Appendix:

Latex Download Center: http://www.ctex.org/CTeXDownload/

Code::Blocks 12.11 error: ‘nullptr’ was not declared in this scope&GNU GCC -std=gnu++0x



Code::Blocks 12.11 error: ‘nullptr’ was not declared in this scope&GNU GCC -std=gnu++0x

Aleeee’s blog
 

C + + primer English Version (Fifth Edition) P54 null points chapter: Modern C + + programs should generally use null and use nullptr instead. So we use code:: blocks to type the code, and the problem comes.

error: ‘nullptr’ was not declared in this scope

So Google answers on the Internet, a lot of English, and finally probably understand that it’s the GNU gcc compiler problem, not the IDE problem of code:: blocks. You just need to type the command line – STD = GNU + + 0x in the compiler. Solution: Code:: blocks integrates GNU gcc compiler, so menu bar – & gt; setting – & gt; compiler , select the global compiler settings page, select GNU gcc compiler at the top of the page, select compiler settings – & gt; compiler flags at the middle of the page, and check have G + + follow the coming C + + 0x ISO C + + language standard [- STD = GNU + + 0x]

Well, the next compilation will be successful! O(∩_ ∩)O~

[C + +] C + + overload operator = must be a nonstatic member function?

code

#include <iostream>
using namespace std;

class C {
public:
    int x;
    C () {}
    C(int a) : x(a) {}
    //  member function
    C operator = (const C&);
};

C C::operator= (const C& param) {
    x = param.x;
    return *this;
}

int main()
{
    C foo(1);
    cout <<"foo.x = " << foo.x << endl;

    C bar;
    bar = foo;
    cout <<"bar.x = " << bar.x << endl;
    return 0;
}

run

foo.x = 1
bar.x = 1

ERROR

opeartor= must be a nonstatic member function

note

quote

Notice that some operators may be overloaded in two forms: either as a member function or as a non member function
many operators can be overloaded as member function or non member function

explain

The so-called member function is shown in the code section. There is a simple declaration about the operator to be overloaded in the class definition, such as:

    C operator = (const C&);

Here the operator = (equal sign) is overloaded;

In contrast, non member function does not exist in the class definition. For example, the complete definition of a class consists of the following:

class D {
public:
    int y;
    D () {}
    D (int b) : y(b) {}
};

There are many operators in C + +, such as = (equal sign), which can only be overloaded as member function. In other words, they must be declared in the class definition. See code;

At the same time, some operators, such as + (plus sign), can be overloaded as both member function and non member function.

doubt

The example code in the part of toturial [1] classes (II) / the keyword this that I read is as follows:

CVector& CVector::operator= (const CVector& param)
{
  x=param.x;
  y=param.y;
  return *this;
}

Note that it is written as cvector & amp; , referring to the class C , then for = (equal sign), it should be written as C & amp; , but in this way, the compiler (Dev C + + ISO C + + 11) will report an error and modify it to the final code before it can be compiled. This is the inconsistency between the current code and the example code.

reference

Classes (II)
http://www.cplusplus.com/doc/tutorial/templates/

TypeError: drop() got an unexpected keyword argument ‘columns’

TypeError: drop() got an unexpected keyword argument ‘columns’

train.drop(columns=["Unnamed: 0"], inplace=True)
test.drop(columns=["Unnamed: 0"], inplace=True)

The reason for the above error is that pandas only added the columns keyword in version 0.21, but not in 0.20.
Solution:
upgrade panda package

pip install --upgrade pandas

View panda version

print (pd.__version__)

Bad default revision ‘head’

HEAD

Git reported the above error, which literally means “wrong default version of head”. Let’s figure out what head is. The GIT manual says:

The head file is a symbolic reference to the branch you’re currently on. By symbolic reference, we mean that unlike a normal reference, it doesn’t generally contain a SHA-1 value but rather a point to another reference.
the head file is a symbolic reference to the current branch. By symbolic reference, we mean that, unlike a normal reference, it usually does not contain a SHA-1 value, but a pointer to another reference.

In short, the head file points to the current branch. If you do not create a custom branch, head points to the Master branch by default. Open the head file, and you can see:

$ cat .git/HEAD
ref: refs/heads/master

The head file is a link file of the file refs / heads / Master . When we create a new user-defined branch, such as dev , switch to the branch and submit the modification under the branch, head points to the branch where the modification was made dev , and open the head file

$ cat .git/HEAD
ref: refs/heads/dev

Therefore, GIT reports an error bad default revision 'head' , which means that the current branch of head is wrong.

terms of settlement

    Modify symbolic links

    You can also manually edit this file, but again a safer command exists to do so: symbolic ref .
    you can modify the head file manually, but there is a more secure command to do it: symbolic Ref.

    for example, I changed head from pointing to Master to pointing to dev :

    git symbolic-ref HEAD refs/heads/dev
    

    Switch branches and submit again

    reference resources

    Git: fatal: bad default revision ‘head’ git internal – git references creating and merging branches – Liao Xuefeng git tutorial

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Hello

HBase only adds a sentence, and the following error will appear when running
failed to execute goal org.codehaus.mojo :exec-maven- plugin:3.0.0 :exec (default-cli) on project HelloSpring: Command execution failed.

Solution: in pom.xml Add in

    <build>
    <finalName>HelloSpring</finalName>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
            <plugins>
                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

Or as follows:

<build>
        <finalName>HelloSpring</finalName>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.3</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>java</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <mainClass>org.company.Main</mainClass>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

The third method: I tried it myself, but I didn’t report this exception
that is, I deleted all the things in the warehouse and re imported them

Nohup command in Linux: nohup: assigning input and attaching output to‘ nohup.out ’

A few days ago, I found a giant cow’s AI learning website, which is easy to understand, funny and humorous. I can’t help sharing it with you. Click to jump to the tutorial.

 

1、 Using nohup in Linux

Under UNIX / Linux, for example, if you want a program to run in the background, many of them use & amp; at the end of the program to make the program run automatically.

For example, we need to run Weblogic in the background:
/ startWebLogic.sh &

But many of our programs are not made into daemons like Weblogic. Maybe our programs are just ordinary programs, which usually use & amp; endings.

But if the terminal is shut down, the program will also be shut down.

But in order to be able to run in the background, we can use the nohup command.

For example, we have a startWebLogic.sh To run in the background, use nohup:

nohup ./ startWebLogic.sh &

Tips:

[~]$ appending output to nohup.out

Well, prove that the program runs successfully, and put the output information of the program running into the current directory nohup.out Go to the file.

Nohup command

Purpose: Linux command usage, running command without hang up.

Syntax: nohup command [Arg…] [& amp;]

Description: the nohup command runs the command specified by the command parameter and any associated Arg parameters, ignoring all the up signals.

After logging off, use the nohup command to run the program in the background. To run the nohup command in the background, add & amp; (the symbol for “and”) to the end of the command.

nohup: ignoring input and appending output to ` nohup.out ‘ignore input and output, record information to nohup.out File.

 

2、 Using Linux redirection to solve the problem nohup.out No write permission problem

■ scene

When executing the nohup command, the following error without write permission often occurs.

nohup: ignoring input and appending output to ` nohup.out ‘
nohup: failed to run command `/etc/nginx_ check.sh ‘: Permission denied

 

■ Linux redirection:

0, 1 and 2 represent standard input, standard output and standard error message output respectively, which can be used to specify the standard input or output to be redirected.

In general use, the default is the standard output, which is 1. When we need special use, we can use other labels.

For example, output the error information of a program to the log file. / program 2 & gt; log.

In this way, the standard output is still on the screen, but the error information will be output to the log file.

 

In addition, the redirection between 0, 1 and 2 can also be realized. 2 & gt; & amp; 1: redirect error messages to standard output.

There is also a special file / dev / null under Linux, which is like a bottomless hole. All the information redirected to it will disappear without a trace.

This is useful to redirect the output to / dev / null when we don’t need to echo all of the program’s information.

If you want both normal output and error information not to be displayed, redirect both standard output and standard error to / dev / null, for example:

# ls 1>/dev/null 2>/dev/null

Another way is to redirect the error to standard output and then to / dev / null, for example:

# ls >/dev/null 2>&1

Note: the order here cannot be changed, otherwise the desired effect cannot be achieved. At this time, redirect the standard output to / dev / null,

Standard errors are then redirected to standard output.

Since standard output has been redirected to / dev / null, standard error will also be redirected to / dev / null, so everything is quiet.

 

About nohup

When using the nohup command, it is often due to the output nohup.out The path for does not have write permission and nohup cannot be used.

This is a way to use Linux redirection to nohup.out Redirect to a path with write permission, or throw it directly into / dev / null.

nohup ./program >/dev/null 2>/dev/null &

perhaps

nohup ./program >/dev/null 2>&1 &

 

3、 Using nohup to set background process

Introduction: sometimes you need to set up a background process on Linux, but when you close terminal, it will be killed by the system. How to make the background process run continuously?

Usage:

nohup command-with-options &

When you tap the above command on the screen, the following information will appear on the screen:

$ nohup: ignoring input and appending output to ` nohup.out ’

Hit enter and exit nohup.out In the current interface, enter the normal command line.

Output log information:

The next output log information will be output to nohup.log . that is, the log information output on the screen is directly output to nohup.log Documents.

Flag of background process:

If a command is only identified by & amp;, it is running in the background in the current session. If the current session is closed or the current terminal tool is closed, its affiliated processes will be closed.

The normal running background process needs nohup and & amp; to ensure its normal running in the background.

 

 

 

Transferred from: https://blog.csdn.net/blueheart20/article/details/78226066

            https://www.cnblogs.com/quchunhui/p/5582371.html

            http://aniyo.iteye.com/blog/1496442

 

ImportError: cannot import name ‘cross_validation’ from ‘sklearn’

Using sklearn (scikit learn) import cross_ An error is reported during validation as follows:

ImportError: cannot import name ‘cross_ validation’ from ‘sklearn’ 

The original code is:

from sklearn import cross_validation as cv

reason:

sklearn.cross_ Validation is a module in the old version of sklearn

The new versions are all migrated to sklearn.model_ selection

The solution will be

cross_ Replace validation with “model”_ selection

from sklearn import model_selection as cv

Problem solving.