sga*_*a62 30 macos shell terminal virtualenvwrapper
我正在关注一个名为Starting a Django 1.4 Project the Right Way的教程,该教程提供了如何使用virtualenv和virtualenvwrapper等方面的指导.
有一节内容如下:
如果你正在使用pip来安装软件包(我不明白你为什么不这样做),你可以通过简单地安装后者来获得virtualenv和virtualenvwrapper.
Run Code Online (Sandbox Code Playgroud)$ pip install virtualenvwrapper安装完成后,将以下行添加到shell的启动文件(.zshrc,.bashrc,.profile等)中.
Run Code Online (Sandbox Code Playgroud)export WORKON_HOME=$HOME/.virtualenvs export PROJECT_HOME=$HOME/directory-you-do-development-in source /usr/local/bin/virtualenvwrapper.sh重新加载你的启动文件(例如source .zshrc),你已经准备好了.
我正在运行Mac OSX,并且不太了解我在终端周围的方式.作者究竟是什么意思shell's start-up file (.zshrc, .bashrc, .profile, etc)?我在哪里可以找到这个文件,以便我可以添加这三行?
另外,他的意思是reload your start up file (e.g. source .zshrc)什么?
我将非常感谢OSX特有的详细回复.
Pau*_*l R 37
您可能正在使用bash,只需将这3行添加到~/.bash_profile:
$ cat >> ~/.bash_profile
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/directory-you-do-development-in
source /usr/local/bin/virtualenvwrapper.sh
^D
Run Code Online (Sandbox Code Playgroud)
在哪里^D意味着你键入Control+ D(EOF).
然后关闭终端窗口并打开一个新窗口,或者你可以.bash_profile像这样"重新加载" :
$ source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
如果你使用bash,通常意味着~/.bash_profile.
在Terminal和iTerm中,默认情况下新的shell是登录shell,因此~/.bashrc根本不读取.如果为其他平台编写的说明告诉您要添加内容.bashrc,则通常需要将其添加到其中.bash_profile.
如果同时~/.profile和~/.bash_profile存在的,只有.bash_profile被读取..profile也被其他shell读取,但是你要添加的许多东西.bash_profile都无法使用它们.
来自/usr/share/doc/bash/bash.html:
当bash作为交互式登录shell或具有--login选项的非交互式shell调用时,它首先从文件中读取并执行命令
/etc/profile(如果该文件存在).读取文件后,它会寻找~/.bash_profile,~/.bash_login和~/.profile,按照这个顺序读取并执行从存在并且可读的第一个命令.[...]
当启动不是登录shell的交互式shell时
~/.bashrc,如果该文件存在,bash将从中读取并执行命令.
| 归档时间: |
|
| 查看次数: |
40710 次 |
| 最近记录: |