How to setup PyDev's python interpreter in ecl

2019-03-01 10:39发布

I want to use pip to install new packages and they say to install pip in a virtualenv. I did that and installed some packages and use them no problem.

But I have a problem setting up the simple google app engine helloworld app under PyDev using python2.7. I set it up to use C:\Python27\env\Scripts\python.exe. But running it gave an error that it couldn't import pdb.

Running the virtualenv python from the cmd line and calling 'import pdb' gave no errors. And typing pdb echoed: module 'pdb' from 'C:\Python27\lib\pdb.py'. So from the cmd line, it could find pdb in the root lib dir. The debug out from appengine said it was using the virtualenv python. I made sure that I had C:\Python27\lib in the System PYTHONPATH when setting up the PyDev interpreter, but this did not matter. Strange. (I also have C:\Python27\DLLs and C:\Python27\lib\lib-tk).

So I tried using the root python exe as the interpreter and it works fine. No problem with pdb, so my code is correct. But now it can't find the modules I added using pip in the virtualenv.

It seems there are 3 options for setting this up correctly:

  1. Somehow setup the PyDev python interpreter using the virtualenv python that will find the root pdb package. (Don't know how to do this, but it seems like the right answer.)
  2. Or will it work to use the root python and add the virtualenv site-packages to my path. (not sure if this will work).
  3. Don't listen to the pip advice - install pip in the root env and install my modules in the root env.

I hope someone who has gone through this before can give some advice as to the best way to proceed with the least amount of problems later.

1条回答
相关推荐>>
2楼-- · 2019-03-01 11:23

I did some research on the google-appengine-python group and they say to go with option 3: Don't listen to the pip advice when using it with google appengine. appengine does not play nice with virtualenv.

Refs:

Appengine with virtualenv

Strange imports (and WARNINGs) in development server

查看更多
登录 后发表回答