简体   繁体   中英

Python error : No module found, even after adding directory to PATH

I installed yfinance in Anaconda Prompt (on Windows 10): pip install yfinance --user .

I got the message:

WARNING: The script sample.exe is installed in 'C:\Users\joseph\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

I added the path C:\Users\joseph\AppData\Roaming\Python\Python37\Scripts to Path in System variables .

But I'm still getting an error message when importing yfinance in Python (Spyder 3.7):

ìmport yfinance

ModuleNotFoundError: No module named 'yfinance'

You need to add the python.exe path along with the scripts path in your system variables.

Click on 'New…' to add the 'Path' variable (note that if your 'Path' variable already exists, then click on 'Edit…' instead)

在此处输入图像描述

Before you type any values, you'll need to locate the relevant Python paths. The paths that you'll need to get are:

  1. The Python application path, which is the folder where you originally installed Python;

  2. The Python Scripts path. The Scripts folder should be located within the Python application path.

For the Variable name, type 'Path'.

For the Variable value, copy the full Python application path, then use semicolon (as highlighted in yellow below), and finally copy the Python Scripts path.

This is how my Variable value looks like:

C:\Users\Ron\AppData\Local\Programs\Python\Python37-32;

C:\Users\Ron\AppData\Local\Programs\Python\Python37-32\Scripts

Put all the values together in the New User Variable box

Press 'OK' and you would then see your new Python Path under the 'User variables' section.

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