0

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'

4
  • Have you tried reinstalling yfinance after adding sample.exe to the PATH, assuming that failed on install? Commented Dec 25, 2020 at 9:29
  • Do you mean I should uninstall it and reinstall it ? Commented Dec 25, 2020 at 9:34
  • If you have successfully edited your PATH, (excellent answer below from Aditya Sarin), what happens when you run, pip install yfinance --user Commented Dec 25, 2020 at 9:41
  • I get a lot of : Requirement already satisfied Commented Dec 25, 2020 at 10:20

1 Answer 1

1

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)

enter image description here

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thx. I added to the Path both : C:\Users\joseph\AppData\Roaming\Python\Python37 (There are 2 files there : site-packages and Scripts) and also C:\ProgramData\Anaconda3 where Python is. But it still doesn't work
Add C:\Users\joseph\AppData\Roaming\Python\Python37 as well as ..\scripts separately.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.