virtualenv: cannot import name 'main'

前端 未结 4 1393
情深已故
情深已故 2020-12-19 06:24

I\'m having a little trouble with virtualenv on Mac OS X Yosemite. After I couldn\'t run virtualenv at all first, I installed Python 3 via brew (previously I in

4条回答
  •  盖世英雄少女心
    2020-12-19 06:51

    Your virtualenv executable /usr/local/bin/virtualenv is importing the virtualenv package /usr/local/bin/virtualenv.py. My guess is that package is not the one the executable should really be importing. The reason it is choosing that one is because it is in the same directory.

    First, check where the real virtualenv package is. In the python3 terminal:

    >>> import virtualenv
    >>> virtualenv.__file__
    

    If it is not /usr/local/bin/virtualenv.py, then the simplest way to get /usr/local/bin/virtualenv to import it instead of /usr/local/bin/virtualenv.py is to delete /usr/local/bin/virtualenv.py (or so you can easily undo this if it doesn't work, simply rename virtualenv.py to something else like xvirtualenvx.py).

提交回复
热议问题