- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试将软件包从 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 的”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}))
最新可行的黑客是什么?
最佳答案
有两个问题必须解决:
对于 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}))
关于python - 将 conda 包安装到 google colab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59330876/
尝试使用命令 conda update conda 从终端更新 conda 时出现错误.它在说: Solving environment: failed UnsatisfiableError: The
在 conda 中,当我尝试安装软件包时,出现此错误: CorruptedEnvironmentError: The target environment has been corrupted. C
我想在一个特定的 conda 环境中安装带有 conda 的程序,并能够使用来自所有 conda 环境的相关命令。 我的目标是让学生在任何平台(尤其是 Windows)上安装 Mercurial(加上
我遇到了一个麻烦的问题。 我的 pip 和 /home/xxx/local/anacoda2/bin 的 python 都可以,但是 conda 仍然不起作用。当我在我的 ubuntu16.04 终端
我已经在普通机器上设置了 Conda 环境。它工作正常。我想在一台无法访问互联网的机器上克隆这个环境(我只能通过 SSH 进入)。 我最初的想法是压缩 Conda 留下的包缓存并将其移动到气隙机器上的
我想要两个环境:生产环境是测试环境的严格子集。我如何使用 Conda(或 micromamba)实现这一目标? 测试需要一些不需要捆绑在生产 docker 镜像中的额外实用程序。主要思想是确保生产安装
每次打开终端时都会显示以下代码行。 Traceback (most recent call last): File "", line 3, in ImportError: No module n
我尝试使用以下命令更新 conda: ~$ conda update conda 它输出以下消息: WARNING conda.base.context:use_only_tar_bz2(632):
如何仅列出 conda 中针对特定环境显式安装的软件包?有没有办法做到这一点? 最佳答案 @Sjlver 的评论链接到的页面( https://github.com/conda/conda/issue
conda 文档指定: conda clean [-h] [-y] [--dry-run] [--json] [--debug] [--verbose] [-q] [-a] [-i] [-l] [-t
当我克隆一个 Conda 环境时 conda create --name thenewenv --clone theorigenv 我注意到 theorigenv 的修订历史丢失了 conda act
我在 Conda 环境中安装了一堆软件包,包括带有 NVIDIA 工具包的 docker 容器和一些其他非 python 库。安装占用了大约 10 GB 的磁盘空间。但是当我删除 Conda 环境时,
documentation指出克隆以这种方式工作:conda create --name myclone --clone myenv但是,这将始终默认创建环境 myclone进入我几乎没有磁盘存储空间
这个问题在这里已经有了答案: Why are packages installed rather than just linked to a specific environment? (1 个回答)
How to list package versions available with conda有有用的答案,其中之一在 https://stackoverflow.com/a/47795843/2
后 conda update --all 我无法再启动 spyder。如果我在终端中运行 spyder,我会收到以下错误: /anaconda3/bin/pythonw: line 3: /anaco
对于给定的 conda包,我如何列出依赖它的包? 我最近在一个已经有 MPI (openmpi) 版本的大学集群上安装了 anaconda。 mpich2包和mpi4py与 anaconda 一起安装
创建虚拟环境时可以将路径/Users/nolan/miniconda/envs/更改为另一个路径吗?我希望它特定于我的项目目录。 (正如我们可以使用 virtualenv 所做的那样) $conda
激活 conda 环境时,conda 会记住之前激活的环境。例如,如果没有激活任何环境,则调用 conda activate foo 然后调用 conda deactivate 将导致没有任何环境处于
我使用 PyCharm 创建了一个带有 conda 解释器的项目。 Pycharm自动为其创建conda环境。不久之后,我意识到我想要该项目的另一个地点。因此我删除了项目文件夹。然后我意识到我要删除
我是一名优秀的程序员,十分优秀!