0

Recently, I copied a python project from different place and got below issue:

I installed python on D:\python27

then I checked sys.path using below code:

import sys
sys.path

I got below ouput:

...
'C:\\Python27\\Lib', 
'C:\\Python27\\DLLs', 

I have no idea where python append the old trash python install path into sys.path. Share any idea will be appreciated. Thanks!

PS: I also checked the PYTHONPATH variable in registry table:

D:\Python27\Lib;D:\Python27\DLLs;D:\Python27\Lib\lib-tk
meng jue
  • 55
  • 4

2 Answers2

0

I would check a few things:

  • Verify that you do not have an older version of Python installed at c:\Python.
  • Make sure to test the value of sys.path before importing or running anything else.
  • If you still have the problem, try running Python directly from its installed path on your D: drive.

Good luck.

Who8MyLunch
  • 1,190
  • 14
  • 20
0

The registry is consulted when setting up sys.path. Unset the registry keys and your python sys.path should look cleaner. For more about how sys.path works, see this answer https://stackoverflow.com/a/38403654/850326

Community
  • 1
  • 1
djhaskin987
  • 9,741
  • 4
  • 50
  • 86