在我的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
问题:
pip仅在~/
运行,需要sudo
在激活的virtualenv中,pip不在ENV/bin
,而在ENV/lib
并且全球运行,在/Library/Python/2.7/site-packages
安装包
3.outside ~/bin
,virtualenv仅在我输入python -m virtualenv venv
nosetests -w /path/to/dir
看起来我必须绕过sys。
问题:
如何重新配置$PATH
以使virtualenv, pip and nosetests
在任何指定目录中工作,而无需sudo
?
如何在virtualenv中安装包内环境中的pip?