![](/img/trans.png)
[英]How to install cx_oracle python module for Google Colaboratory
[英]How to install a third party module in Google Colaboratory
我需要在 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
如何在 Google colab 中安裝 CFITSIO 模塊並編譯它?
不需要sudo
。 在 Colab 上,您已經以 root 身份運行。
這是一個完整的示例筆記本:
https://colab.research.google.com/drive/1RqtDwzhL8vWEJ-3ruGUGo-QckWr6gHUJ
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.