在Spyder上安装模块

问题描述 投票:0回答:1

我正在尝试在spyder独立版本上安装quandl模块。

我尝试在 iPhyton 控制台上运行 !pip install quandl 命令,但收到此输出


Python path configuration:
  PYTHONHOME = '/Applications/Spyder.app/Contents/Resources'
  PYTHONPATH = (not set)
  program name = '/Users/gianluca/miniconda3/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/Applications/Spyder.app/Contents/Resources/lib/python3.11'
  sys._base_executable = '/Users/gianluca/miniconda3/bin/python'
  sys.base_prefix = '/Applications/Spyder.app/Contents/Resources'
  sys.base_exec_prefix = '/Applications/Spyder.app/Contents/Resources'
  sys.platlibdir = 'lib'
  sys.executable = '/Users/gianluca/miniconda3/bin/python'
  sys.prefix = '/Applications/Spyder.app/Contents/Resources'
  sys.exec_prefix = '/Applications/Spyder.app/Contents/Resources'
  sys.path = [
    '/Applications/Spyder.app/Contents/Resources/lib/python311.zip',
    '/Applications/Spyder.app/Contents/Resources/lib/python3.11',
    '/Applications/Spyder.app/Contents/Resources/lib/python3.11/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00000001de7b5000 (most recent call first):
  <no Python frame>

我还尝试直接从我的 MAC 终端安装模块(pip install quandl),一切都很好,但我认为我已经在不同的 python 解释器上安装了该模块,因为如果我尝试在 Spyder 上导入模块,它不起作用。我还尝试更改 Spyder 上的解释器,但我在 iPhyton 控制台上收到此消息

An error ocurred while starting the kernel
The Python environment or installation whose interpreter is located at
    /Users/gianluca/miniconda3/bin/python
doesn't have the spyder‑kernels module or the right version of it installed (>= 2.5.0 and < 2.6.0). Without this module is not possible for Spyder to create a console for you.

You can install it by activating your environment first (if necessary) and then running in a system terminal:
    conda install spyder-kernels=2.5
or
    pip install spyder-kernels==2.5.*

所以我尝试在终端上运行命令 conda install spinder-kernels=2.5 但我看到了这条消息

Retrieving notices: ...working... done
Channels:
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed

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

  - spyder-kernels=2.5*

Current channels:

  - defaults

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.

有人知道我必须做什么才能最终在我的 Spyder 上安装该模块吗? 谢谢你帮助我:)

python spyder
1个回答
0
投票

我认为你想要做的就是在 Anaconda 环境中安装

quandl

就上下文而言,您不会“在 Spyder 中”安装 Python 包; Spyder 是一个用 Python 编写的 IDE,是 Anaconda Python 分发环境的核心。要完成大多数事情,您需要安装带有spyder、numpy、matplotlib 等的Python...这些都是不同的Python 包。 Anaconda 只是为那些在必须构建/编译某些东西时不想在终端/控制台中进行修改的人提供了一个分发和包管理系统。

您可以在此处找到有关安装软件包的说明: https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/installing-with-conda.html

conda
是 Anaconda 的“包管理器”。您想要做的是尝试启动 Anaconda 控制台,您将处于包含 Spyder 包(和其他 Python 包)的环境中并执行
conda install quandl
命令。

请注意,您可能需要启用具有

quandl
包的不同 Anaconda 存储库(如 conda-forge)。

© www.soinside.com 2019 - 2024. All rights reserved.