简体   繁体   中英

Yahoo finance in Spyder (Anaconda)

I successfully installed Yahoo finance in Anaconda

When I type

 pip list

in the Anaconda Prompt, it shows that yahoo finance is there.

But when I try to import it on Spyder, I get the error: "No module named 'yfinance"

Basically your error message it because Spyder isn't configured to work with conda's environment.

Check this link here and the possibles solutions from it:

Installing packages into the same environment as Spyder

Spyder is a Python package just like any other you may be used to, and so you can import any package within its Console or Editor as you could from a regular Python or IPython terminal launched in Spyder's environment:

  • If Spyder is installed with Anaconda (as we recommend) and launched via a shortcut, from Anaconda Navigator or from Anaconda Prompt without modifying anything, this will be the default base Anaconda environment.

  • If Spyder is installed via pip (experts only) and not into a virtualenv/venv, this will usually be whatever Python installation pip itself belongs to.

  • If you use a system package manager (apt-get, dnf, emerge, etc) to install Spyder, this will typically be your system Python and its library of packages.

  • If you installed Spyder into a specific environment (conda-env or venv), or it came with a pre-configured one (like those for Keras or TensorFlow) and launched it from there, it will only have access to packages from that environment.

Therefore, if you'd like to use a package with your existing Spyder install (eg import'ing it into your scripts, packages or a Spyder IPython console), the simplest way to do so is to install the package into the same environment in which you installed Spyder, typically by the same means you installed Spyder (conda, pip, package manager, etc). However, if you're installing packages with pip, conda-forge, Github, or custom channels, working on multiple major projects at once, using prebuilt environments, or otherwise have more sophisticated needs, you'll likely want to use one or more separate environments for your packages. If so, the next section explains how.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM