我正在尝试使用python 2.6.6通过 pip 在 CentOS版本6.7(最终版) 上安装virtualenvwrapper:
sudo pip install virtualenvwrapper
然后我执行了这些以添加到.bashrc WORKON_HOME:
echo "export WORKON_HOME=~/Env" >> ~/.bashrc
echo "source /usr/bin/virtualenvwrapper.sh" >> ~/.bashrc
当我尝试用这个来初始化virtualenvwrapper时:
source ~/.bashrc
我收到了这个错误:
Traceback (most recent call last):
File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/usr/lib/python2.6/site-packages/virtualenvwrapper/hook_loader.py", line 223, in <module>
main()
File "/usr/lib/python2.6/site-packages/virtualenvwrapper/hook_loader.py", line 101, in main
console = logging.StreamHandler(stream=sys.stderr)
TypeError: __init__() got an unexpected keyword argument 'stream'
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
我发现here此问题已修复,但修复程序尚未发布,现在我问,有没有办法手动修复它?
答案 0 :(得分:4)
感谢@jhonkola,这也解决了我的问题。
pip install virtualenvwrapper 4.7.0必须在stevedore 1.9.0之前,或者stevedore会升级到最新版本,会引发logging.NullHandler。
尝试这些在python 2.6 env下安装virtualenvwrapper。
sudo pip install virtualenvwrapper==4.7.0 -U
sudo pip install stevedore==1.9.0 -U
答案 1 :(得分:2)
似乎virtualenvwrapper 4.7.1导致了这个问题,而4.7.0工作正常。我还使用了stevedore 1.9.0,这是支持python 2.6的最后一个。
我在AWS Linux上运行这些版本,它应该接近CentOS。