简体   繁体   中英

PIP install packages but some not found

Some pip installs don't work on a computer, since recently I changed to Python 3.

for example, pywinauto

I used CMD:

C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Scripts>pip install pywinauto
C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Scripts>pip freeze

It shows:

pywinauto==0.6.8

But when I:

import pywinauto

It gives:

ModuleNotFoundError: No module named 'pywinauto'

I moved the 2 folders "pywinauto" and "pywinauto-0.6.8.dist-info" from:

C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\

To:

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

And:

import sys
sys.path.append('C:\\Users\\NAME\\AppData\\Local\\Programs\\Python\\Python37-32\\Scripts\\')

It still doesn't work. (it works for some other cases)

Windows 64 settings seem ok with: Environment Variables > User variables

C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Scripts\
C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\
C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\
C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages

Environment Variables > System variables

C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\
C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Lib\
C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages

ps I have Anaconda installed in the machine, and no Python 2. Not sure whether it causes the problem.

  1. Go to your conda terminal, activate the virtual environment .
  2. pip install < your package name >.
  3. Now go to your editor where you're running this code. (like pycharm or Sublime)
  4. select your python interpreter as venv (Anaconda). Usually this option is available in project setting. Run your code, it should work now.

Seems the problem relates to Anaconda.

Problem solved by run CMD:

C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Scripts>pip instsall pywinauto

Then manually moved the 2 folders "pywinauto" and "pywinauto-0.6.8.dist-info" from:

C:\Users\NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\

To:

C:\Users\NAME\AppData\Local\Continuum\anaconda3

The package functions normally.

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