简体   繁体   中英

PIP --upgrade not working Python3.4.4

I've looked at a number of posts on this and nothing seems to fix it. I initally started out on Python 3.5, heard that there were several unresolved issues with pip and so I uninstalled and reinstalled Python 3.4.4 -

I want to use pyautogui for a work task, but when I try to install pyautogui directly after Python3.4.4 installation it tells me the PIL Module can't be found. I read in another article to install 3.4.4 and update pip, then install pyautogui. Cool, so I installed 3.4.4, I needed to upgrade pip. So I entered in

Scripts\pip.exe install --upgrade pip

from the command line in the root folder. Every time I get this

 Exception:
Traceback (most recent call last):
  File "h:\python34\lib\shutil.py", line 527, in move
    os.rename(src, real_dst)
PermissionError: [WinError 32] The process cannot access the file because it is
being used by another process: 'h:\\python34\\scripts\\pip.exe' -> 'C:\\Users\\z
jf\\AppData\\Local\\Temp\\pip-qo75adq9-uninstall\\python34\\scripts\\pip.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "h:\python34\lib\site-packages\pip\basecommand.py", line 211, in main
  File "h:\python34\lib\site-packages\pip\commands\install.py", line 311, in run

  File "h:\python34\lib\site-packages\pip\req\req_set.py", line 640, in install
  File "h:\python34\lib\site-packages\pip\req\req_install.py", line 716, in unin
stall
  File "h:\python34\lib\site-packages\pip\req\req_uninstall.py", line 125, in re
move
  File "h:\python34\lib\site-packages\pip\utils\__init__.py", line 315, in renam
es
  File "h:\python34\lib\shutil.py", line 540, in move
    os.unlink(src)
PermissionError: [WinError 32] The process cannot access the file because it is
being used by another process: 'h:\\python34\\scripts\\pip.exe'

Thing is, nothing is running in that folder. I don't have windows explorer open to it, I don't have anything accessing any files in there, and I'm obviously running it from an upper level directory using the command line. So I have no idea why it's saying that pip.exe is being used by another process. The only process it's being run by is itself and if that's the issue, then how in the world are you supposed to upgrade it?

**EDIT: ** Per the accepted answer, in order to get PIP to update I used the command

python -m pip install -U pip

Once that worked I tried to install pyautogui yet again. It still said that PIL module could not be found. PIL is the Python Image Library. I installed it using

python -m pip install image

And once that worked I then installed pyautogui like so

python -m pip install pyautogui

To upgrade pip on windows google "upgrade pip on windows" or alternately run this in a command prompt:

python -m pip install -U pip

This is a known issue on windows where an executable can't be overwritten while it's running. Sorry no links handy but it should be easy to find more details.

Problem: You are using pip version 18.1, however version 19.0.1 is available. You should consider upgrading via the 'python -m pip install –upgrade pip' command.

Solution: In order to upgrade PIP in Windows, you'll need to open the Windows Command Prompt, and then type/copy the command below. Note that the following method would only work if you already added Python to Windows path. Don't worry if you don't know what it means, as I'll show the full steps to upgrade pip in windows in the next section.

python -m pip install --upgrade pip

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