Installing MacOS to VirtualBox
https://medium.com/@twister.mr/installing-macos-to-virtualbox-1fcc5cf22801
https://medium.com/@twister.mr/installing-macos-to-virtualbox-1fcc5cf22801
ref: https://stackoverflow.com/questions/29987716/cannot-use-gsl-library-on-macos-ld-symbols-not-found-for-architecture-x86-6 Indeed, as @trojanfoe and @bergercookie said you have to compile your file and then link it to the library. As explained in compile and link, for that particular example: First compile the file: gcc -Wall -I/usr/local/include -c example.c -o example.o second, link it to the library: gcc -L/usr/local/lib example.o -lgsl -o example where of course, /usr/local/lib should be replaced for the path where you have gsl installed. The example file is excutable. EDIT: in macOS, from Yosemite the default location for the installation is /opt/local/lib (and /opt/local/include)
Install CUDA on Mac This instruction is following the Online Documentation for CUDA Toolkit. Some notifications for tf-gpu installation: After tf 1.2, the source code building becomes the only way of installation of TensorFlow-GPU in Mac OSX. link And tensorFlow nolonger support GPU on OSX. 这带来了很多安装的不确定性和难度。 从源码安装是可能的途径,但是有人制作whl放在网上供下载。github link python=3.6.5 CUDA=9.2.148 cuDNN=7.1.4 tf-gpu=1.9 可参考的一个配置选项,来自pyTorch社区 1.1 系统要求: Cuda 兼容的 GPU OSX 10.13 Clang 编译器 和 toolchain 安装自Xcode CUDA Toolkit: https://developer.nvidia.com/cuda-toolkit-archive Guided by: Online Documentation Xcode版本 9.2, Apple LLVM版本9.0.0, 如何检查: /usr/bin/cc --version 如何下载:https://developer.apple.com/download/more/
…python代码执行bash命令相关 – python3 cook book refer: https://python3-cookbook.readthedocs.io/zh_CN/latest/c13/p06_executing_external_command_and_get_its_output.html 执行外部命令并获取它的输出 问题 执行一个外部命令并以Python字符串的形式获取执行结果。 解决方案 使用 `subprocess.check_output()` 函数。例如: import subprocess out_bytes = subprocess.check_output(['netstat','-a']) 上段代码执行指定的命令,并将执行结果以字节字符串的形式返回。 如果你需要文本形式的返回,加一个解码步骤即可。例如: out_text = out_bytes.decode('utf-8') 如果被执行的命令以非零码返回,就会抛出异常。 下面的例子捕获错误并获取返回码: try: out_bytes = subprocess.check_output(['cmd','arg1','arg2']) except subprocess.CalledProcessError as e: out_bytes = e.output # Output generated before error code = e.returncode # Return code Quick Example Code: import subprocess cmd = ['netstat','-a'] try: out_bytes = subprocess.check_output(cmd) out_text = out_bytes.decode('utf-8') except subprocess.CalledProcessError as e: out_bytes = e.output # Output generated before error code = e.returncode # Return code More: check_output() 的几个参数 ☆check_output() 的stderr 参数: 默认情况下,check_output() 仅仅返回输入到标准输出的值。 如果你需要同时收集标准输出和错误输出,使用 stderr 参数:
…分享这个post是自己方便查,还有中文网界对这个东西介绍太少。 更多的就看github项目twint吧。 Installation: git+pip3: git clone https://github.com/twintproject/twint.git pip3 install -r requirements.txt pip3 install twint or pip3+pipenv: pip3 install --user --upgrade -e git+https://github.com/twintproject/twint.git@origin/master#egg=twint pipenv install -e git+https://github.com/twintproject/twint.git#egg=twint You may meet module cannot found error when you try to run twint after installation. On ubuntu, add ~/.local/bin into your PATH by: export PATH=$PATH:~/.local/bin You may edit ~/.bashrc file to permanately add the ‘~/.local/bin’ into your PATH. Usage: Running the twint cmd with arguments can give you results. A few simple examples to help you understand the basics:
…Note: Contents below may out-of-date. But the procedures are referable. Avaliable version combinations for pyTorch/Tensorflow-gpu: python=3.6.5 CUDA=9.2.148 cuDNN=7.1.4 tf-gpu=1.9 python=3.6.5 CUDA=9.1.85 cuDNN=7.1.3 tf-gpu=1.8 CUDA=9.0.176 cudnn=7.3.1.20 tensorflow-gpu=1.12.0 CUDA=9.0; cuDNN=7.4.1 tensorflow-gpu=1.12.0; cuda=9.0; cudnn=7.5.0 tensorflow=1.8.0可以用的 python=3.6.7 cuda=9.0; cuDNN=7.4.2 tensorflow-gpu = 1.9.0 pytorch = 1.0.0 cuda=9.0; cudnn=7.0.5 ================= ================= Install: CUDA=9.0 CUDNN=7.0.5 http://www.twistedwg.com/2018/06/15/cuda9_cudnn7.html https://blog.csdn.net/lukaslong/article/details/81488219 ================= 注意python3, pip3, Follow pyTorch web: https://pytorch.org/get-started/locally/ UPDATE: sudo apt update sudo apt upgrade curl sudo apt-get install curl or: sudo apt install curl check: curl --version Anaconda curl -O https://repo.
…How to install Tensorflow GPU with CUDA 10.1 for python on Windows 在cuda 10.0的windows上安装Tensorflow GPU, python ref: https://www.pytorials.com/how-to-install-tensorflow-gpu-with-cuda-10-0-for-python-on-windows/ But the above link is too complicated and the success is not garanteed. Before start, Notations neet to know: 20190825: Note the cuda10.1 is NOT supported by pyTorch by now. Want pyTorch? recommend: cuda10.0 Install Tensorflow GPU with CUDA 10.1 for python on Windows Tasks (四位爷): Install visual studio Install Cuda (i.e., Cuda ToolKit) Install cuDNN Install tensorflow 那么问题是,这四位爷的版本得对上。 所以就有人做了这个东西:https://github.com/fo40225/tensorflow-windows-wheel 里面详细列出来每个安装包对应的四位爷的版本。follow this link to strictly keep the fix of versions.
…put the below into inst_gpu.sh file: #!/bin/bash ## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04 ### steps #### # verify the system has a cuda-capable gpu # download and install the nvidia cuda toolkit and cudnn # setup environmental variables # verify the installation # CUDA 9.0 requires NVIDIA driver version 384 or above ### ### to verify your gpu is cuda enable check lspci | grep -i nvidia ### gcc compiler is required for development using the cuda toolkit.
…对列表按概率采样 Input: a collection C of elements and a probability distribution p over C; Output: an element chosen at random from C according to p. C有n 个元素,1-n, 概率 (p = (p[1], …, p[n])。 我们只有random.random()函数,它会给我们均匀分布的[0,1]上的一个float. 基本思想是分割[0,1]into n segments of length p[1] … p[n] ( ∑ p[i] = 1) . 如果均匀地在[0,1]上打点,那它在第i个segment上停住的概率就是p[i]. 因此可以用random.random()函数来实现。查看停止的地方在[0,1]的哪个位置,然后返回其所在的那个segment index. python如下实现: ref: https://scaron.info/blog/python-weighted-choice.html 对列表按概率采样 import random import collections def weighted_choice(seq, weights): assert len(weights) == len(seq) assert abs(1. - sum(weights)) < 1e-6 x = random.random() for i, elmt in enumerate(seq): if x <= weights[i]: return elmt x -= weights[i] def gen_weight_list(seq, gt_set, incline_ratio): ''' :param seq: :param gt_list: :param incline_ratio: :return: seqe = [1,2,3,4,5] gt_list = [3,5,7] # incline_ratio = 0.
…图的度数分布 import collections import matplotlib.pyplot as plt import networkx as nx G = nx.gnp_random_graph(100, 0.02) degree_sequence = sorted([d for n, d in G.degree()], reverse=True) # degree sequence # print "Degree sequence", degree_sequence degreeCount = collections.Counter(degree_sequence) deg, cnt = zip(*degreeCount.items()) # #as an alternation, you can pick out the top N items for the plot: #d = sorted(degreeCount.items(), key=lambda item:item[1], reverse=True)[:30] # pick out the up 30 items from counter #deg = [i[0] for i in d] #cnt = [i[1] for i in d] fig, ax = plt.
…