我需要使用Google colab中的cfitsio
库编译一些c程序,在我的mac中,我可以执行以下操作:
1. download the files and unzip it http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html
2.
sudo -H ./configure --enable-sse2 --prefix=/usr/local --enable-reentrant
sudo -H make
sudo -H make install
但是,我不允许在google colab中使用sudo(当然这是必需的行为)
当我尝试在没有sudo的情况下安装模块时,它给了我权限错误
import sys
ENV_COLAB = 'google.colab' in sys.modules
if ENV_COLAB:
### mount google drive
from google.colab import drive
drive.mount('/content/drive')
%%bash
cd "drive/My Drive/Colab Notebooks/Research/cfitsio-3.47"
./configure --user --enable-sse2 --enable-reentrant
# step3: module installation fails
bash: ./configure: /bin/sh: bad interpreter: Permission denied
如何在GoogleColab中安装CFITSIO模块并进行编译
不需要
sudo
。在Colab上,您已经以root身份运行下面是一个完整的笔记本示例:
https://colab.research.google.com/drive/1RqtDwzhL8vWEJ-3ruGUGo-QckWr6gHUJ
相关问题 更多 >
编程相关推荐