问题
I'm trying to test out creating virtual envs through conda create
on OS X. It's my first real foray into virtual envs so I'm still wrapping my mind around how to tool them. My first test was
$ conda create -p /users/me/anaconda/envs/envtest
$ source activate /users/me/anaconda/envs/envtest
But when I go to take it down via source deactivate
, I get:
Error: too many arguments.
Some googling seems to indicate that there is some configuration in my .profile file that's affecting this but that file is empty. It will probably help to show my .bash_profile
:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# Added by Canopy installer on 2013-09-12
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
VIRTUAL_ENV_DISABLE_PROMPT=1 source /Users/ibebian/Library/Enthought/Canopy_64bit/User/bin/activate
PYTHONPATH="/Library/Python/2.7/site-packages/:$PYTHONPATH"
export PYTHONPATH
set PATH = "$PATH:/Users/ibebian/Desktop/Postgres.app/Contents/MacOS/bin"
# added by Anaconda 1.8.0 installer
export PATH="/Users/ibebian/anaconda/bin:$PATH"
Any insight here? Much appreciated!
回答1:
Yes, the problem is the set PATH = "$PATH:/Users/ibebian/Desktop/Postgres.app/Contents/MacOS/bin"
line. set
sets default arguments for bash functions ($1
, $2
, and so on). So deactivate
thinks it is being called as deactivate PATH = "$PATH:/Users/ibebian/Desktop/Postgres.app/Contents/MacOS/bin"
, rather than just deactivate
.
To assign to a variable, just use
PATH="$PATH:/Users/ibebian/Desktop/Postgres.app/Contents/MacOS/bin"
(note there are no spaces here)
来源:https://stackoverflow.com/questions/23002694/conda-source-deactivate-produces-error-too-many-arguments