Python激活环境变量

7 python environment-variables virtualenv

使用环境变量,成功创建了vartualenv,但当我尝试通过myenv/bin/activate激活它时,它表示糟糕的地方().

virtualenv my env
source myenv/bin/activate
badly placed()'s
Run Code Online (Sandbox Code Playgroud)

我也试过./myenv/bin/activate.我该如何解决这个问题?我应该放在哪里()?

fal*_*tru 26

如果您使用*csh或fish,请使用activate.cshactivate.fish代替activate:

falsetru@ubuntu:/tmp$ tcsh
ubuntu:/tmp> virtualenv aa
New python executable in aa/bin/python
Installing setuptools............done.
Installing pip...............done.
ubuntu:/tmp> source aa/bin/ac
activate          activate.csh      activate.fish     activate_this.py
ubuntu:/tmp> source aa/bin/activate      # <----------------
Badly placed ()'s.
ubuntu:/tmp> source aa/bin/activate.csh  # <----------------
[aa] ubuntu:/tmp>
Run Code Online (Sandbox Code Playgroud)

  • 考虑编辑:找到你使用echo $ shell的shell,如果../csh然后是activate.csh等 (2认同)