python - 显然conda找不到一些非常常见的包: what am I doing wrong?

标签 python package installation conda

环境:我在配备 High Sierra 的 Mac 上使用 conda 4.6.7。

我有一些遗留的 Python 代码,首先我想运行它。当然,由于这是研究代码,我没想到会找到“花哨的东西(!!)”,例如测试套件,但我希望至少有一个 requirements.txt 文件提供。白日梦。在对组成项目的各个文件的导入列表进行 GREP 后,我得出了以下要安装的包列表:

conda install os sys math time scipy numpy zipfile urllib.request shutil PIL skimage config itertools logging json re random collections matplotlib visualize glob random datetime tensorflow keras colorsys IPython

我将所有这些都放在对 conda 的一次调用中,因为根据

https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands

你应该

Install all the programs that you want in this environment at the same time. Installing 1 program at a time can lead to dependency conflicts.

(顺便说一句,有没有办法在命令中包含换行符,或者它必须那么长吗?)

但是,conda 给了我错误:

PackagesNotFoundError: The following packages are not available from current channels:

  - config
  - math
  - visualize
  - datetime
  - urllib.request
  - re
  - logging
  - json
  - os
  - glob
  - collections
  - sys
  - colorsys
  - itertools
  - random
  - zipfile
  - time
  - shutil
  - skimage

这对我来说似乎很奇怪,因为至少其中一些很常见。这些是我的 conda 环境中的软件包:

# Name                    Version                   Build  Channel
ca-certificates           2019.1.23                     0
certifi                   2018.11.29               py36_0
libcxx                    4.0.1                hcfea43d_1
libcxxabi                 4.0.1                hcfea43d_1
libedit                   3.1.20181209         hb402a30_0
libffi                    3.2.1                h475c297_4
ncurses                   6.1                  h0a44026_1
openssl                   1.1.1b               h1de35cc_0
pip                       19.0.3                   py36_0
python                    3.6.8                haf84260_0
readline                  7.0                  h1de35cc_5
setuptools                40.8.0                   py36_0
sqlite                    3.26.0               ha441bb4_0
tk                        8.6.8                ha441bb4_0
wheel                     0.33.1                   py36_0
xz                        5.2.4                h1de35cc_4
zlib                      1.2.11               h1de35cc_3

如何解决上述问题?

最佳答案

大多数这些软件包(例如 mathrandomitertools...)都是 python standard library 的一部分。 ,因此应该可以在任何标准的 python 安装中使用(即使它们没有出现在 conda list 的输出中)。因此,Conda 不会单独安装它们或将它们包含在其软件包列表中。

您尝试的其他问题与包的名称有关。例如,您尝试安装 scikit-image,但使用缩写名称 skimage(一旦安装就会使用它进行导入, 例如导入skimage)。如果您使用 conda install scikit-image,conda 会找到它。

关于python - 显然conda找不到一些非常常见的包: what am I doing wrong?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55003896/

相关文章:

python - 如何安装 python 包

json - 错误 : Cannot read config file: X:\package. json

linux - 如何在不访问存储库的情况下更新具有依赖项的 CentOS 软件包

linux - 如何强制RPM在单个目录中安装文件,可能吗?

python - 如何检查 pandas DataFrame 是否为空?

python - AbstractUser 模型的 django 1.8.5 迁移失败

Python raw_input 故障并返回 -bash : line 1: <INPUT>: command not found

postgresql - 我应该如何修复此 PostgreSQL 安装?

java - 保护用于分发的 Java jar 文件

python - 高效地逐行构建 Pandas 数据框