3

On my Mac OSX 10.9.2, my default python is now Python 2.7.6, which was upgraded form 2.5.4, the previous sys installation.

I have pip 1.5.4 from /Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg (python 2.7) and virtualenv --version 1.11.4 both installed at ~/bin, and which virtualenv and which pip return ./bin/pip and ./bin/virtualenv

which python returns: /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 has:

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

my .bash_profile has:

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

PROBLEMS:

  1. pip runs only at ~/, and requires sudo

  2. inside activated virtualenv, pip is not at, say, ENV/bin but at ENV/lib and runs GLOBALLY, installing packages at /Library/Python/2.7/site-packages

3.outside ~/bin, virtualenv runs only if I type python -m virtualenv venv

  1. nosetests runs only with nosetests -w /path/to/dir

looks like I have to bypass sys.

QUESTIONS:

  1. how do I reconfigure $PATH in order to have virtualenv, pip and nosetests working at ANY given directory, without the need for sudo?

  2. how to have pip within virtualenv installing packages INSIDE the environment?

8-Bit Borges
  • 9,643
  • 29
  • 101
  • 198
  • please check the following: http://stackoverflow.com/questions/4324558/whats-the-proper-way-to-install-pip-virtualenv-and-distribute-for-python – xosp7tom Apr 17 '14 at 18:35
  • thanks, I had already checked this link. didn't find my answers there, though. my questions concern (re-)configuration of PATHs rather than installing pip and virtualenv. what's really bothering me is how to make pip install locally within virtualenv and not globally. – 8-Bit Borges Apr 18 '14 at 02:17
  • Probably a silly question, but have you *activated* the virtual env? I think it gets activated by default when you create it, but if you close the window or log out or whatever, you'll need to reactivate it. So try: `. ./path/to/virtual/env/bin/activate` (note that there are two dots in that command, separated by a space) – falsePockets May 23 '17 at 04:07

0 Answers0