如何设置正确的$ PATH到PIP,VIRTUALENV和NOSETESTS

时间:2014-04-17 18:11:33

标签: python path pip virtualenv nosetests

在我的Mac OSX 10.9.2上,我的默认python现在是Python 2.7.6,它是从先前的sys安装2.5.4升级的。

pip 1.5.4 from /Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg (python 2.7)virtualenv --version 1.11.4都安装在~/bin,以及哪个virtualenv和哪个点子返回./bin/pip./bin/virtualenv

哪个python返回:/usr/local/bin/python

sys.path:

['', '/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg', '/Library/Python/2.7/site-packages/projectname-0.1-py2.7.egg', '/Library/Python/2.7/site-packages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']

~/bin有:

Vitors-MacBook-Pro:bin vitorpatalano$ ls -lha
total 328
drwxr-xr-x  16 vitorpatalano  staff   544B Apr 13 21:57 .
drwxr-xr-x+ 31 vitorpatalano  staff   1.0K Apr 17 11:06 ..
-rw-r--r--@  1 vitorpatalano  staff   6.0K Apr  6 01:28 .DS_Store
-rwxr-xr-x   1 root           staff   232B Apr  6 23:45 easy_install
-rwxr-xr-x   1 root           staff   232B Apr  6 23:45 easy_install-2.7
-rwxr-xr-x@  1 vitorpatalano  staff    76K Apr 10 23:26 mate
-rwxr-xr-x   1 root           staff   373B Apr  7 00:07 nosetests
-rwxr-xr-x   1 root           staff   381B Apr  7 00:07 nosetests-2.7
-rwxr-xr-x   1 root           staff   241B Apr  6 01:29 pip
-rwxr-xr-x   1 root           staff   243B Apr  6 01:29 pip2
-rwxr-xr-x   1 root           staff   247B Apr  6 01:29 pip2.7
-rwxr-xr-x   1 root           staff   211B Apr  6 22:46 virtualenv
-rwxr-xr-x   1 root           staff   211B Apr  6 22:46 virtualenv-2.7
-rwxr-xr-x   1 root           staff   346B Apr 13 21:57 virtualenv-clone
-rwxr-xr-x   1 root           staff    36K Apr 13 21:56 virtualenvwrapper.sh
-rwxr-xr-x   1 root           staff   1.4K Apr 13 21:56 virtualenvwrapper_lazy.sh

我的.bash_profile有:

export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}
export PATH=/usr/local/bin:$PATH
export PATH=./bin:$PATH

问题:

  1. pip仅在~/运行,需要sudo

  2. 在激活的virtualenv中,pip不在ENV/bin,而在ENV/lib并且全球运行,在/Library/Python/2.7/site-packages安装包

  3. 3.outside ~/bin,virtualenv仅在我输入python -m virtualenv venv

    时才会运行
    1. nosetests仅与nosetests -w /path/to/dir
    2. 一起运行

      看起来我必须绕过sys。

      问题:

      1. 如何重新配置​​$PATH以使virtualenv, pip and nosetests在任何指定目录中工作,而无需sudo

      2. 如何在virtualenv中安装包内环境中的pip?

0 个答案:

没有答案