问题描述
我想使用pip安装新软件包,它们对 说:在virtualenv中安装pip .我做到了,并安装了一些软件包,并使用它们没有问题.
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.
从cmd行运行virtualenv python并调用"import pdb"不会产生任何错误.并输入pdb回显:来自'C:\ Python27 \ lib \ pdb.py'的模块'pdb'.因此,从cmd行中,它可以在根lib目录中找到pdb.从appengine进行的调试表明,它使用的是virtualenv python.设置PyDev解释器时,我确保在系统PYTHONPATH中具有C:\ Python27 \ lib,但这并不重要.奇怪的. (我也有C:\ Python27 \ DLL和C:\ Python27 \ lib \ lib-tk).
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).
所以我尝试使用root python exe作为解释器,并且工作正常. pdb没问题,所以我的代码是正确的.但是现在它找不到在virtualenv中使用pip添加的模块.
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.
似乎有3个正确设置此设置的选项:
It seems there are 3 options for setting this up correctly:
- 以某种方式使用将找到根pdb软件包的virtualenv python设置PyDev python解释器. (不知道该怎么做,但这似乎是正确的答案.)
- 或者使用根python并将virtualenv站点程序包添加到我的路径中是否可行. (不确定是否可行).
- 不要听pip的建议-在根环境中安装pip并在根环境中安装我的模块.
我希望曾经经历过此问题的人可以就以后处理最少问题的最佳方法提供一些建议.
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.
推荐答案
我对google-appengine-python组进行了一些研究,他们说要使用选项3: Google Appengine. appengine在virtualenv上不能很好地发挥作用.
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.
参考:
这篇关于如何在virtualenv中使用pip在Eclipse中设置PyDev的python解释器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!