简体   繁体   中英

Pydev (python 3) on Eclipse Oxygen: “pip” not working with installed packages

pip for python 3.6.4 (on Oxygen) originally, but no longer lists any installed packages, eg pip , whee l, pyodbc . But running pip from the (DOS) command line lists all expected packages. And pip for the co-installed 3.5.1 lists all expected packages (see Preferences -> Pydev -> Interpreters-> Python Interpreters - or right click the project's icon and select properties).
Environment is 64 bit Win 7 Enterprise SP1. All packages in both interpreters were manually installed using pip from outside of Eclipse. Word length (32 or 64 bit) did not make a difference.

All applications are running normally on Oxygen under 3.6.4. One oddity (& probable red herring) that could be a clue is that is all interpreters (since Helios if not earlier) have consistently flagged my import pyodbc lines as being an error - but all applications with that "error" work without any problems.

Eclipse Mars is also on the machine and it uses the same python installation folders as Oxygen. From the timing of the problem I had a suspicion that the pip problem started after I had to use Mars (which may have done something to the common installation folder that messed up Oxygen's setup). However I tried replicating the problem using 3.5.1 but the problem did not reoccur.

I've tried everything reasonably obvious short of messing around with Eclipse internal/folders, including deleting ALL interpreters from Oxygen, then recreating them (in the same folder) AFTER cold-starting my machine. Running the file system sychronization check (found at Preferences -> Pydev -> Interpreters) did not help.

I have a lot of projects in Oxygen (and Mars). Short of reinstallation, is there a reasonably simple way to get 3.6.4's pip to work properly on Oxygen - bearing in mind that I must keep Mars installed to maintain other projects?

This problem was filed as issue 896 on the pydev tracker ( https://www.brainwy.com/tracker/PyDev/ )

A clue to a workaround is that an error message did not appear when I used pip with the "bad" 3.6.4 interpreters, all that appeared was a "FINISHED" message.

I removed the ".eclipse" folder from my "C:\\users\\username" folder and removed all python interpreters from Eclipse. Next, the appropriate pydev install package was used to uninstall both 3.6.4 interpreters from my system (they could not deleted until after they had been repaired using the installer).

System was rebooted and Eclipse opened. Both 3.5.1 interpreters we reinstalled without any issues (pip listed the expected packages: pip, wheel, etc). Then tried installing both versions of 3.6.4. Both times the pip message area displayed :

Traceback (most recent call last):
  File "c:\python364\32bit\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python364\32bit\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python\3.6.4\32bit-bad pip\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
FINISHED

Note that the first two lines incorrectly refer to "python364" instead of the correct install location ("python\\3.6.4", as shown on the last line). The "c:\\python364" folder was a holdover from a previous attempt at installing 3.6.4; that folder also contained a subfolder that contained the 32 bit 3.6.4 interpreter.

Summarizing the sequence of events that fixed my problem:

1) Deleted the ".configure" subfolder from my home folder (may not be needed yet)
2) Removed all 4 interpreters from Eclipse.
3) Removed all artifacts from previous 3.6.4 python installs.
4) Used the appropriate pydev install package to repair, then remove both bad interpreters from my system.
5) Deleted ".eclipse" from my home folder.
6) Rebooted my machine and installed all 4 interpreters into Eclipse.
7) Problem fixed. pip for all 4 intepreters now lists all expected packages.

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