ImportError: No module named virtualenv

前端 未结 8 2041
孤城傲影
孤城傲影 2021-02-01 00:50

I am using Django 1.3.7 and python 2.7.6 on windows7 I got an error when I executing my manage.py in this line of code

import shutil, sys, virtualenv, subprocess         


        
相关标签:
8条回答
  • 2021-02-01 01:46

    I think the problem is you need sudo to globally install virtualenv.

    > pip install virtualenv
    Could not find an activated virtualenv (required).
    > sudo pip install virtualenv
    Downloading/unpacking virtualenv
    ...
    

    But this creates files readable only by root (depending on the umask). In this case, uninstalling/reinstalling may not always help.

    You can check with ls -la /usr/local/lib/python2.7/dist-packages/virtualenv.py (replacing 2.7 with whatever version you have or are targeting).

    My solution was simply:

    sudo chmod -R o+rX /usr/local/lib/python2.7
    
    0 讨论(0)
  • 2021-02-01 01:50

    I had to install virtualenv with the -H flag to set HOME variable to target user's home dir.

    sudo -H pip install virtualenv

    0 讨论(0)
提交回复
热议问题