我试着安装从anaconda到google的colab的软件包。
但不起作用。整个事情都是巫毒魔法。
以下代码位于一个单元格中。
笔记本电脑电池:
!wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
!bash Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local/
!rm Miniconda3-latest-Linux-x86_64.sh
!conda install -y --prefix /usr/local/ ujson aiohttp tqdm
import sys
os.environ['PYTHONPATH'] = "/usr/local/miniconda3"
os.environ['PATH'] = '/usr/local/miniconda3/bin:' + os.environ['PATH']
sys.path.append('/usr/local/lib/python3.6/site-packages/')
import ujson结果:
ModuleNotFoundError: No module named 'ujson'如果我使用"! bash“进入bash shell,然后运行"bash's”python,则可以在该python中导入ujson。但是,如果我直接在“笔记本的”python中导入ujson,它就不能工作。
这里的方法似乎不再有效了
!wget -c https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
!chmod +x Miniconda3-4.5.4-Linux-x86_64.sh
!bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local
!conda install -q -y --prefix /usr/local ujson
import sys
sys.path.append("/usr/local/conda/lib/python3.6/site-packages/")
print(ujson.dumps({1:2}))最新的黑客攻击是什么?
发布于 2019-12-14 00:46:16
有两个问题必须解决:
对于1,需要将python=3.6添加到conda install中。
对于2,您需要向/usr/local/lib/python3.6/site-packages添加路径
这是新代码
# same
!wget -c https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
!chmod +x Miniconda3-4.5.4-Linux-x86_64.sh
!bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local
# update 1
!conda install -q -y --prefix /usr/local python=3.6 ujson
# update 2
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
# test it
import ujson
print(ujson.dumps({1:2}))发布于 2019-12-14 02:29:47
在google中,朱庇特IDE,尝试执行:
!pip install ujson这以前对我有用过。如果现在能用,请告诉我。
发布于 2021-08-28 04:36:43
#如果有人想使用google实现,只需在编译其他单元之前运行以下命令
!wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.2-Linux-x86_64.sh
!chmod +x Minicda3-py37_4.8.2-Linux-x86_64.sh
!bash ./Miniconda3-py37_4.8.2-Linux-x86_64.sh -b -f -p /usr/本地导入系统
sys.path.append('/usr/local/lib/python3.7/site-packages/‘
https://stackoverflow.com/questions/59330876
复制相似问题