小编Wil*_*ill的帖子

如何在不破坏apt的情况下更新Python 3的替代方案?

前几天,我决定让python命令默认启动python3而不是python2。

所以我这样做:

sudo update-alternatives --install /usr/bin/python python /usr/bin /python2.7 2

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 3
Run Code Online (Sandbox Code Playgroud)

sudo update-alternatives --config python

$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.5   3         auto mode
  1            /usr/bin/python2.7   2         manual mode
  2            /usr/bin/python3.5   3         manual mode

Press <enter> to keep the current choice[*], or type selection number: 0
Run Code Online (Sandbox Code Playgroud)

而且一切正常。大!:)

$ python -V
Python 3.5.2
Run Code Online (Sandbox Code Playgroud)

但是不久之后,我就意识到在安装和删除python软件包时我已经打破了apt / aptitude的范畴,因为apt期望python2能够实现。

就是这样

$ …
Run Code Online (Sandbox Code Playgroud)

python linux ubuntu debian apt

17
推荐指数
5
解决办法
4万
查看次数

Jenkinsfile:一次定义并为多个变量赋值似乎没有实现

我在Red Hat Linux上使用Jenkins 2.6.我想在我的Jenkins文件中使用以下内容,但是当我尝试时,Jenkins抱怨道.(似乎只是不喜欢=运算符左侧的语法.):

def (a, b) = [6, 7]
Run Code Online (Sandbox Code Playgroud)

它似乎不喜欢Multiple Assignments,但Groovy 1.6及更高版本显然支持它们,根据这篇文章:

http://mrhaki.blogspot.co.uk/2009/09/groovy-goodness-multiple-assignments.html

我想这样做,以便当我调用一个返回[6,7]的方法时,我可以像这样调用它:

def (a, b) = mymethod()

def mymethod()
{
    return [6, 7]
}
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我这是否适用于詹金斯,如果是这样,詹金斯的版本是什么?或者它是不受支持的功能?还是一个bug?

谢谢

groovy jenkins jenkinsfile

7
推荐指数
1
解决办法
2627
查看次数

什么是nm告诉我关于在Linux上使用gcc编译的程序中的vtable?

我将Base类更改为抽象(即我将其中一个方法设为纯虚拟)并重新编译它.当我将它与派生类链接时,链接器抱怨了vtable.我用nm调查了一些事情,但我不确定nm告诉我的是什么.我只是通过删除*.o文件并重新编译Derived类来解决问题,但我想了解这里的vtable究竟发生了什么.

我的原始代码是这样的:

Base.h

class Base {
    public:
       virtual void doSomething();
};
Run Code Online (Sandbox Code Playgroud)

Base.cpp

#include <iostream>
#include <Base.h>
void Base::doSomething() {
    std::cout << "Base::doSomething()" << "\n";
}
Run Code Online (Sandbox Code Playgroud)

Derived.h

#include <Base.h>
class Derived : public Base {
    public:
        Derived();
        void doSomething() override;
};
Run Code Online (Sandbox Code Playgroud)

Derived.cpp

#include <iostream>
#include <Derived.h>
Derived::Derived() {
    std::cout << "Derived::Derived() constructor" << "\n";
}
void Derived::doSomething() {
    std::cout << "Derived::doSomething()" << "\n";
}
Run Code Online (Sandbox Code Playgroud)

Makefile包含以下内容:

CXXFLAGS = -std=c++14 -pedantic -Wall -Werror -I ./

default: build
clean:
    rm -f proggy
    rm -f …
Run Code Online (Sandbox Code Playgroud)

c++ inheritance gcc vtable nm

2
推荐指数
1
解决办法
763
查看次数

标签 统计

apt ×1

c++ ×1

debian ×1

gcc ×1

groovy ×1

inheritance ×1

jenkins ×1

jenkinsfile ×1

linux ×1

nm ×1

python ×1

ubuntu ×1

vtable ×1