小编ast*_*lrx的帖子

ubuntu 14.04,pip无法升级matplotllib

当我尝试使用pip升级matplotlib时,它会输出:

Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.0.tar.gz#md5=1daf7f2123d94745feac1a30b210940c
  Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
  Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.4.0]
                    python: yes [2.7.6 (default, Mar 22 2014, 22:59:38)  [GCC
                            4.8.2]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.8.2]
                       six: yes [using six version 1.7.3]
                  dateutil: yes [using dateutil version 2.2]
                   tornado: yes [using tornado version 4.0.1]
                 pyparsing: yes [using pyparsing version 2.0.2]
                     pycxx: yes [Couldn't import.  Using …
Run Code Online (Sandbox Code Playgroud)

python pip matplotlib

50
推荐指数
3
解决办法
4万
查看次数

将 Zsh 历史记录保存到 ~/.persistent_history

最近想在Mac上试试Z shell。但是我想继续将命令历史记录保存到 ~/.persistent_history,这就是我在 Bash ( ref ) 中所做的。

但是,参考链接中的脚本在 Zsh 下不起作用:

log_bash_persistent_history()
{
   [[
     $(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$
   ]]
   local date_part="${BASH_REMATCH[1]}"
   local command_part="${BASH_REMATCH[2]}"
   if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
   then
     echo $date_part "|" "$command_part" >> ~/.persistent_history
     export PERSISTENT_HISTORY_LAST="$command_part"
   fi
}
run_on_prompt_command()
{
   log_bash_persistent_history
}
PROMPT_COMMAND="run_on_prompt_command"
Run Code Online (Sandbox Code Playgroud)

有没有人可以帮助我让它工作?非常感谢!

bash shell zsh

9
推荐指数
2
解决办法
2540
查看次数

C++类模板构造函数 - 带数组(U*)的重载引用(U&)失败

我正在尝试构建一个构造函数,将一个数组作为一个参数,重载另一个采用标量的人.代码如下.

#include <iostream>

template <typename T>
class SmallVec { // This is a 3 dimensional vector class template
public:
    T data[3] = {0}; // internal data of class
    template <typename U>
    explicit SmallVec(const U& scalar) { // if a scalar, copy it to each element in data
        for(auto &item : data) {
            item = static_cast<T>(scalar);
        }
    }
    template <typename U>
    explicit SmallVec(const U* vec) { // if a vector, copy one by one
        for(auto &item : data) {
            item = …
Run Code Online (Sandbox Code Playgroud)

c++ arrays templates constructor constructor-overloading

5
推荐指数
1
解决办法
894
查看次数