0

我想用 pychecker 进行代码分析,但是当它导入 python 代码时,它不使用来自 virtualenv 的包,它使用系统范围的包,并且导入失败。

有没有办法在 virtualenv 中安装 pychecker,或者至少让它从 virtualenv 中导入包?

4

1 回答 1

0

Set your $PYTHONPATH environmental variable to the site-packages directory.

For me, pychecker was not able to find the configobj module. Since I use zsh (bash with lots of bells and whistles), I ran:

> find ~/venv-ops -name configobj.py
/Users/doug/venv-ops/lib/python2.7/site-packages/configobj.py
> export PYTHONPATH=/Users/doug/venv-ops/lib/python2.7/site-packages

and then pycheck worked fine.

于 2013-09-02T18:41:44.203 回答