【问题标题】:Can't set alias within Pipenv无法在 Pipenv 中设置别名
【发布时间】:2019-04-21 09:16:08
【问题描述】:

我正在使用 Pipenv 来管理 Django 项目的虚拟环境。我想设置一个在我的 Pipenv 中工作的别名,以执行冗长(且经常使用)的 python 命令。

我尝试通过将以下行添加到我的 .env 文件来设置此别名:

alias launch='python manage.py collectstatic --noinput; heroku local'

但是,当我在 Pipenv 中运行新的 launch 命令时,它无法识别:

$ pipenv shell
$ launch
bash: launch: command not found

有没有办法为我的 Pipenv .env 文件添加别名,以便每次执行 pipenv shell 时加载它?

【问题讨论】:

    标签: bash alias pipenv


    【解决方案1】:

    .env 文件仅用于设置环境变量。它不是shell脚本,不能包含alias等任意命令。

    【讨论】:

    • 谢谢。我最终通过添加到我的 .bashrc 文件来创建别名,它似乎是在我运行 pipenv shell 时导入的。
    猜你喜欢
    • 2020-08-27
    • 2018-03-07
    • 2018-12-14
    • 1970-01-01
    • 2022-01-27
    • 2016-11-26
    • 1970-01-01
    • 2022-11-04
    • 2021-02-20
    相关资源
    最近更新 更多