Shebangs in conda managed environments

佐手、 提交于 2019-12-01 15:13:50

问题


I am trying to write a program in Hy and run it per the instructions on the Quickstart page in the documentation.

So I installed Hy using pip from the GitHub repo per the docs, then added executable permissions to the file with chmod +x myfile.hy.

To manage my Python environments, I use Anaconda's conda, rather than virtualenv. Hence the shebang #! /usr/bin/env hy does not work for me, since the conda envs live in a different directory. From conda info --envs I see that their directories are

myenv     * /home/myname/.conda/envs/myenv 
root        /home/myname/anaconda3

Now attempting to run the script with #! /home/myname/.conda/envs/myenv hy bash throws a bad interpreter: Permission denied error.

Where should shebangs point in this case?


回答1:


#!/usr/bin/env hy will actually work with Conda. You just need to say source activate myenv before running the script.



来源:https://stackoverflow.com/questions/41131901/shebangs-in-conda-managed-environments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!