问题描述
我正在尝试测试在OS X上通过conda create
创建虚拟环境的方法.这是我对虚拟环境的第一次真正的尝试,因此我仍在思考如何使用它们.我的第一个测试是
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
但是当我通过source deactivate
将其取下来时,我得到了:
But when I go to take it down via source deactivate
, I get:
Error: too many arguments.
某些搜索似乎表明我的.profile文件中有一些配置影响此,但该文件为空.可能有助于显示我的.bash_profile
:
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!
推荐答案
是的,问题出在set PATH = "$PATH:/Users/ibebian/Desktop/Postgres.app/Contents/MacOS/bin"
行. set
设置bash函数的默认参数($1
,$2
等).因此deactivate
认为它被称为deactivate PATH = "$PATH:/Users/ibebian/Desktop/Postgres.app/Contents/MacOS/bin"
,而不只是deactivate
.
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)
这篇关于康达'源停用'产生错误:参数过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!