Linux搭建OpenCV环境

  1. sudo apt-get install build-essential
  2. sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
  3. sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
  4. git clone https://github.com/opencv/opencv.git
  5. 使用CMake编译OpenCV源代码:
    1. 创建一个临时文件夹,用来存放生成的makefiles。Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the generated Makefiles, project files as well the object files and output binaries.
    2. 进入这个临时文件夹:cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local <opencv源代码路径>

  6. 在这个临时文件夹下运行make -j8 # -j8 runs 8 jobs in parallel. Change 8 to number of hardware threads available.
  7. 运行:sudo make install

参考资料:

  1. https://docs.opencv.org/3.0-beta/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
  2. https://docs.opencv.org/3.4.0/d7/d9f/tutorial_linux_install.html

Linux挖以太坊

克隆https://github.com/ethereum-mining/ethminer 源代码

mkdir build; cd build

如果使用CUDA:cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF

如果使用OpenCL则直接运行cmake ..即可

cmake –build .

sudo make install

ethminer –S guangdong-pool.ethfans.org:3333 –SP 1 –O **.eth01

  1. 加入火星ETH矿池:https://eth.ethfans.org/#/ guangdong-pool.ethfans.org:3333
  2. **为钱包地址,可到https://www.zb.com/生成

 

Jupyter notebook 宽屏显示

只需运行:

from IPython.core.display import display, HTML
display(HTML(“<style>.container { width:100% !important; }</style>”))

参考资料: [1]

Linux安装ASTRA:fatal error: mex.h: no such file or directory

先下载源代码:http://www.astra-toolbox.com/docs/install.html#linux-from-source

进入源代码目录:make 出现 fatal error: mex.h: no such file or directory 错误提示:

查找原因,发现是matlab版本与官网教程版本不同。于是修改配置即可:

我都matlab是2014a,把R2012a改成R2014a就可以了。

装完后,设置matlab path
Add $HOME/astra/matlab and its subdirectories (tools, mex) to your matlab path

紧接着测试,出现新问题:invalid MEX-file

查阅官方文档,发现有如下说明:

NB: Each matlab version only supports a specific range of g++ versions. Despite this, if you have a newer g++ and if you get errors related to missing GLIBCXX_3.4.xx symbols, it is often possible to work around this requirement by deleting the version of libstdc++ supplied by matlab in MATLAB_PATH/bin/glnx86 or MATLAB_PATH/bin/glnxa64 (at your own risk), or setting LD_PRELOAD=/usr/lib64/libstdc++.so.6 (or similar) when starting matlab.

这段话应该是针对matlab 2012a的 在2014a中MATLAB_PATH/bin/glnxa64不存在这个文件。但是可以确定是由于gcc版本问题,而导致的动态链接库出错。所以只要找到matlab里的libstdc++ 这个文件删除了就可以了。
用find MATLAB_PATH –name “libstdc++.so*”查找

删除MATLAB_PATH/sys/os/glnxa64 里的这两个libstdc++ 文件即可。

解决Aclocal command not found

安装ASTRA时出现了Aclocal command not found的错误

解决办法:sudo apt install automake

紧接着出现:configure.ac:42:error: possibly undefined macro: AC_PROG_LIBTOOL

解决办法:sudo apt install libtool

参考资料:[1]

 

Pickle:EOFError: Ran out of input

这天用pickle的时候出现这个问题,一查发现原来是读取了空的文件的缘故。

可以看到train_y文件是0 bytes。