简体   繁体   中英

PIP install package - installed but python is not importing

Running on Windows 10, I have Python 3.7.3 installed to my c/users/myUser/appdata/local/programs folder. When I use PIP to install a package, it seems to run fine, but when I use "import package" in python it doesn't recognize that package. What would cause this?

Running 'python --version' works and also running 'pip --version' works.

PIP shows up in my c/users/myUser/appdata/local/programs/python37-32/lib/site-packages/pip folder.

UPDATE: So I was looking through files to determine where the libraries are located that do work with my python. The folder is located in Python/Python37-32/Lib. All of those currently work when importing. However when I do anything with PIP it does not add anything to that folder. I noticed there are a couple different PIP executables within Python/Python37-32/Scripts which include pip.exe, pip3.exe, and pip3.7.exe. I tried using "pip3.7 install numpy" which also did not work. I noticed when trying to add an existing package its pointing to the Python37-32/lib/site-packages folder.

SOLUTION:

I removed python from my machine, and reinstalled it. I had the same problem. What I done to fix this was to use PS python -m pip install --user package

Also I appended my PATH environment variable with cmd setx path "%path%;C:\Users\MyUser\AppData\Roaming\Python\Python38\Scripts"

That seemed to have taken care of my issue. Now when I install a package with PIP I can reference it through python.

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