Articles of Linux操作系统

在Ubuntu上安装python-igraph时出错(从命令行)

我试图从命令行安装python-igraph。 我在AWS服务器上创build了一个新的Ubuntu实例,所以我必须从命令行执行所有操作。 这是我从一个全新的Ubuntu安装完成的: $sudo apt-get update $sudo apt-get install build-essential $sudo apt-get install python-dev $sudo apt-get update $sudo apt-get install python-pip $sudo apt-get update $sudo pip install python-igraph 我得到以下错误: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/python-igraph/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install –record /tmp/pip-XxxMbQ-record/install-record.txt –single-version-externally-managed –compile failed with error code 1 in /tmp/pip_build_root/python-igraph Traceback (most recent […]

ffmpeg将任何文件转换为任何文件

我希望简单的命令转换任何支持的文件到任何文件,尽可能less的video压缩。 例如 avi to mp4 mp4 to 3gp . .etc.. 我尝试了下面的代码 ffmpeg -i infile.flv outfile.3gp 它适用于一些,但对于其他一些像flv to 3gp转换它会抛出像下面的错误,也输出文件的大小是比input非常大。 "Error while opening encoder for output stream #0:0 – maybe incorrect parameters such as bit_rate, rate, width or height" P:si与下面的图书馆合并 ./configure –enable-version3 –enable-libopencore-amrnb –enable-libvo-aacenc –enable-libopencore-amrwb –enable-libvpx –enable-libfaac –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libxvid –enable-gpl –enable-postproc –enable-nonfree 全面响应 array(48) […]

Haskell:quoteFile在unicode字符上的“无效字节序列”的文本文件上失败

我在我的虚拟环境(Debian Wheezy与GHC 7.8.4安装)中quoteFile面临问题。 我从Text.Shakespeare.Text描述了准标准文件的文件版本: import Language.Haskell.TH.Quote (QuasiQuoter, quoteFile) import Text.Shakespeare.Text (st) sfFile :: QuasiQuoter stFile = quoteFile st 这在我的主机上运行得非常好,但是,在我的虚拟环境(Docker镜像)上出现以下错误: 尝试运行编译时代码时发生exception:test-file.md:hGetContents:无效的参数(无效的字节序列) 代码:Language.Haskell.TH.Quote.quoteExp stFile“test-file.md” 我的小REPL调查显示,文本文件中的第一个Unicode字符发生错误,在我目前的情况下,这是'«'左指针双angular引号: import System.IO (IOMode(..), hGetContents, openFile, openBinaryFile, utf8) main = do h <- openBinaryFile "test-file.md" ReadMode hGetContentContents h — Binary read works fine out-of-box. h' <- openFile "test-file.md" ReadMode hSetEncoding h' utf8 hGetContentContents […]

Cocos2D-X编译Linux错误:未定义的引用

我是新来的cocos2D-X(3.6版),我使用Linux来编译和运行我的项目。 当我尝试下面的命令行时: cocos compile -p linux 它给我错误: Linking CXX executable bin/MyGame CMakeFiles/MyGame.dir/Classes/AppDelegate.cpp.o: In function `AppDelegate::applicationDidFinishLaunching()': /home/caisar/MyCompany/MyGame/Classes/AppDelegate.cpp:53: undefined reference to `GraphicsScene::createScene()' collect2: error: ld returned 1 exit status make[2]: *** [bin/MyGame] Error 1 make[1]: *** [CMakeFiles/MyGame.dir/all] Error 2 make: *** [all] Error 2 Error running command, return code: 2 这是我的GraphicsScene.h : #ifndef __GRAPHICS_SCENE_H__ #define __GRAPHICS_SCENE_H__ #include […]

尝试在Anaconda中安装软件包的错误解释器错误

我试图安装neo到我的Anaconda分布使用 conda install -c https://conda.binstar.org/neuroinf neo (取自这里 ),但得到错误: bash: /transform/anaconda/bin/conda: /usr/local/anaconda/bin/python: bad interpreter: No such file or directory 它不是find/usr/local/anaconda/bin/python因为它不存在。 我已经在/transform/anaconda/安装了/transform/anaconda/ 。 我已经编辑了我的.bashrc文件来反映这一点,但由于某些原因,它仍然在/usr/local/ (至less在某些方面,请注意,它正确地在/transform/查找第一个目录参数)。 我需要改变什么来查看/transform/anaconda/bin/python ? echo $PATH返回: /transform/anaconda/bin:/usr/bin:/transform/anaconda/bin:/usr/bin:/transform/anaconda/bin:/usr/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/PHShome/gcw8/bin (我意识到这很麻烦,当我得到一分钟后我会清理它) 我正在运行CentOS和Python 2.7。

我怎样才能安全地通过SSH返回一个bash数组?

在bash shell中,可以用declare -p轻松地引用数组,然后在稍后eval它们以使其恢复正常。 这似乎可以接受通过SSH传递数组(作为脚本的一部分)到远程计算机。 问题是,穿越电线,我不希望有相同的信任水平。 如果远程机器受到威胁,感染可能通过未经协商的eval语句传播到本地机器。 目前,为了在机器之间传递数组,我使用了如下的方法: #!/bin/bash # Define the modules we expect to find installed on the remote machine expected_modules=(foo-module bar 'baz 2.0') # SSH into the remote machine, send the arrays back and forth with "declare -p" unparsed_missing_modules=$(ssh remote-machine /bin/bash << EOF check_for_module() { # Placeholder so that this can be tested […]

通过bash脚本与来自多个目录的文件进行交互

我生成了一个脚本,它遍历几个.csv文件,将相关文件转换为UTF-8: #!/bin/bash cd /home/user/prod/ charset="text/plain; charset=iso-8859-1" for file in *.csv; do if [[ $(file -i "$file") == "$file: $charset" ]]; then iconv -f ISO-8859-1 -t UTF-8 "$file" > "$file.new"; mv -f "$file.new" "$file"; fi done 这是有效的,但我真的很喜欢遍历文件驻留在不同的path。 我试着开始设置一个path(而不是定义一个当前的目录),但我无法得到它的工作: #!/bin/bash path="/home/user/prod" charset="text/plain; charset=iso-8859-1" for file in "$path/*.csv"; do if [[ $(file -i "$file") == "$file: $charset" ]]; […]

在输出文件上做“rm”之后,C程序在哪里写输出?

我在一个运行Redhat的计算集群上运行了一个相当讨厌的C程序,它进入了一个无限循环,在每个循环中它都打印了一行输出。 当我意识到它正在快速创build一个最终会耗尽所有磁盘空间的文件时,我在杀死程序之前在该输出文件上运行了“rm”。 不幸的是,在我终于杀死了这个程序之前,每个“df -h”的空间仍然在驱动器上用完了。 我现在找不到所写的文件,所以我无法删除它。 这样的文件会写在哪里?

一些内核的ARM代码

我正在阅读一些ARM内核源码,直到我偶然发现了以下function: 314 #define __get_user_asm_byte(x, addr, err) \ 315 __asm__ __volatile__( \ 316 "1: " TUSER(ldrb) " %1,[%2],#0\n" \ 317 "2:\n" \ 318 " .pushsection .fixup,\"ax\"\n" \ 319 " .align 2\n" \ 320 "3: mov %0, %3\n" \ 321 " mov %1, #0\n" \ 322 " b 2b\n" \ 323 " .popsection\n" \ 324 " .pushsection […]

在terminal上用正则expression式分组提取string

我有一个文本文件conatins像这样的HTML信息: <li><a href="https://www.youtube.com/watch?v=YDubYJsZ9iM&amp;list=PL5-da3qGB5IBC-MneTc9oBZz0C6kNJ-f2">Lab: K-means Clustering</a> (6:31)</li> <li><a href="https://www.youtube.com/watch?v=4u3zvtfqb7w&amp;list=PL5-da3qGB5IBC-MneTc9oBZz0C6kNJ-f2">Lab: Hierarchical Clustering</a> (6:33)</li> <li><a href="https://www.youtube.com/watch?v=jk9S3RTAl38&amp;list=PL5-da3qGB5IC8_kWZXDcmLx7_n4RTBkAS">Interview with John Chambers</a> (10:20)</li> <li><a href="https://www.youtube.com/watch?v=6l9V1sINzhE&amp;list=PL5-da3qGB5IC8_kWZXDcmLx7_n4RTBkAS">Interview with Bradley Efron</a> (12:08)</li> <li><a href="https://www.youtube.com/watch?v=79tR7BvYE6w&amp;list=PL5-da3qGB5IC8_kWZXDcmLx7_n4RTBkAS">Interview with Jerome Friedman</a> (10:29)</li> <li><a href="https://www.youtube.com/watch?v=MEMGOlJxxz0&amp;list=PL5-da3qGB5IC8_kWZXDcmLx7_n4RTBkAS">Interviews with statistics graduate students</a> (7:44)</li> 我用grep -oP "https:\/\/www.youtube.com\/watch\?v=([A-Za-z0-9-_]+)" list > links提取链接,使得list是html文件。 从另一方面,我需要提取每个文件的名称,即我需要像这样的另一个列表: Lab: K-means Clustering Lab: Hierarchical Clustering Interview with John Chambers Interview with […]