为什么我不能用 pip 或 miniconda 安装 matplotlib 或 pandas?
Why can't I install matplotlib or pandas with pip OR miniconda?
Windows 10
Python3.1
我编写的脚本需要 pandas 和 matplotlib。但是,即使我在 cmd 中尝试了 pip 并在 Miniconda 中尝试了 conda,我还是无法安装。
这是我在 cmd 中尝试通过 pip 安装时遇到的错误(即 py -m pip install -U matplotlib
:
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Nick\miniconda3\envs\name_of_my_env\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Nick\AppData\Local\Temp\pip-install-jlytfo2_\matplotlib_5bffd16903a8431f98af43098502973c\setup.py'"'"'; __file__='"'"'C:\Users\Nick\AppData\Local\Temp\pip-install-jlytfo2_\matplotlib_5bffd16903a8431f98af43098502973c\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Nick\AppData\Local\Temp\pip-wheel-3tmzcurv'
cwd: C:\Users\Nick\AppData\Local\Temp\pip-install-jlytfo2_\matplotlib_5bffd16903a8431f98af43098502973c\
Complete output (551 lines):
在 conda 中,当我尝试 conda install matplotlib
时,我得到了这个:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.1
Current channels:
- https://conda.anaconda.org/conda-forge/win-64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
我真的不确定出了什么问题,因为当我在另一台 PC 上通过类似方式安装这些软件包时,我没有 运行 遇到这些问题,而且我 肯定 确实安装了 Python 3.1。任何帮助将不胜感激,谢谢!
尝试新建一个环境,直接在其中安装matplotlib和numpy,如下:
conda create --new env_nick python=3.8 numpy matplotlib
然后,激活环境为
conda activate env_nick
您的 python 版本旧并且与一些更新的软件包不兼容。
Conda 4.10 与 python 3.10 不兼容。
创建并激活 python 3.10 环境后,您基本上无法安装任何东西。你甚至不能安装 conda-build:
conda install conda-build -y
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
ResolvePackageNotFound:
- python=3.1
Conda 4.10 contains python 3.9 and conda 4.11 contains python 3.10,所以你的基础环境应该兼容其中的python版本。
如果需要python3.10+
如果您需要 python 3.10 或更新版本,您必须拥有 conda 4.11 或更新版本。安装所需的 conda 版本,或切换到基础环境并使用 conda update conda
.
update conda
如果你想保留旧的conda
安装另一个 python 3.9 或更早版本的环境,例如 conda create --name py39 python=3.9
并激活它。
Windows 10 Python3.1
我编写的脚本需要 pandas 和 matplotlib。但是,即使我在 cmd 中尝试了 pip 并在 Miniconda 中尝试了 conda,我还是无法安装。
这是我在 cmd 中尝试通过 pip 安装时遇到的错误(即 py -m pip install -U matplotlib
:
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Nick\miniconda3\envs\name_of_my_env\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Nick\AppData\Local\Temp\pip-install-jlytfo2_\matplotlib_5bffd16903a8431f98af43098502973c\setup.py'"'"'; __file__='"'"'C:\Users\Nick\AppData\Local\Temp\pip-install-jlytfo2_\matplotlib_5bffd16903a8431f98af43098502973c\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Nick\AppData\Local\Temp\pip-wheel-3tmzcurv'
cwd: C:\Users\Nick\AppData\Local\Temp\pip-install-jlytfo2_\matplotlib_5bffd16903a8431f98af43098502973c\
Complete output (551 lines):
在 conda 中,当我尝试 conda install matplotlib
时,我得到了这个:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.1
Current channels:
- https://conda.anaconda.org/conda-forge/win-64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
我真的不确定出了什么问题,因为当我在另一台 PC 上通过类似方式安装这些软件包时,我没有 运行 遇到这些问题,而且我 肯定 确实安装了 Python 3.1。任何帮助将不胜感激,谢谢!
尝试新建一个环境,直接在其中安装matplotlib和numpy,如下:
conda create --new env_nick python=3.8 numpy matplotlib
然后,激活环境为
conda activate env_nick
您的 python 版本旧并且与一些更新的软件包不兼容。
Conda 4.10 与 python 3.10 不兼容。
创建并激活 python 3.10 环境后,您基本上无法安装任何东西。你甚至不能安装 conda-build:
conda install conda-build -y
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
ResolvePackageNotFound:
- python=3.1
Conda 4.10 contains python 3.9 and conda 4.11 contains python 3.10,所以你的基础环境应该兼容其中的python版本。
如果需要python3.10+
如果您需要 python 3.10 或更新版本,您必须拥有 conda 4.11 或更新版本。安装所需的 conda 版本,或切换到基础环境并使用 conda update conda
.
如果你想保留旧的conda
安装另一个 python 3.9 或更早版本的环境,例如 conda create --name py39 python=3.9
并激活它。