Rumah  >  Soal Jawab  >  teks badan

pip - python的virtualenvwrapper问题

1 在Mac上安装python2.7.3
2 安装pip
3 安装virtualenv

pip install virtualenv

4 安装virtualenvwrapper

pip install virtualenvwrapper

5 vim ~/.bash_profile

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

export VIRTUALENVWRAPPER_PYTHON=python2.7
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

6 source配置

source ~/.bash_profile

问题来了!
创建新的虚拟环境

mkvirtualenv env1

和运行workon时

workon env1

都提示下面信息

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named virtualenvwrapper.hook_loader

Google了一些貌似python或pip的path问题,~/.bash_profile里的配置还不够吗?

天蓬老师天蓬老师2764 hari yang lalu671

membalas semua(1)saya akan balas

  • 巴扎黑

    巴扎黑2017-04-17 11:16:17

    export VIRTUALENVWRAPPER_PYTHON=python2.7

    改成export VIRTUALENVWRAPPER_PYTHON=`which python`试试

    另外试试重装virtualenvwrapper

    sudo pip install --upgrade virtualenvwrapper
    

    balas
    0
  • Batalbalas