<bdo id='pIv2O'></bdo><ul id='pIv2O'></ul>

      <legend id='pIv2O'><style id='pIv2O'><dir id='pIv2O'><q id='pIv2O'></q></dir></style></legend>

      1. <small id='pIv2O'></small><noframes id='pIv2O'>

        <i id='pIv2O'><tr id='pIv2O'><dt id='pIv2O'><q id='pIv2O'><span id='pIv2O'><b id='pIv2O'><form id='pIv2O'><ins id='pIv2O'></ins><ul id='pIv2O'></ul><sub id='pIv2O'></sub></form><legend id='pIv2O'></legend><bdo id='pIv2O'><pre id='pIv2O'><center id='pIv2O'></center></pre></bdo></b><th id='pIv2O'></th></span></q></dt></tr></i><div id='pIv2O'><tfoot id='pIv2O'></tfoot><dl id='pIv2O'><fieldset id='pIv2O'></fieldset></dl></div>
        <tfoot id='pIv2O'></tfoot>

        我可以使用单个 python 脚本来创建 virtualenv 并安装 requirements.txt 吗?

        Can I use a single python script to create a virtualenv and install requirements.txt?(我可以使用单个 python 脚本来创建 virtualenv 并安装 requirements.txt 吗?)

        1. <legend id='Ls56Y'><style id='Ls56Y'><dir id='Ls56Y'><q id='Ls56Y'></q></dir></style></legend>

          • <i id='Ls56Y'><tr id='Ls56Y'><dt id='Ls56Y'><q id='Ls56Y'><span id='Ls56Y'><b id='Ls56Y'><form id='Ls56Y'><ins id='Ls56Y'></ins><ul id='Ls56Y'></ul><sub id='Ls56Y'></sub></form><legend id='Ls56Y'></legend><bdo id='Ls56Y'><pre id='Ls56Y'><center id='Ls56Y'></center></pre></bdo></b><th id='Ls56Y'></th></span></q></dt></tr></i><div id='Ls56Y'><tfoot id='Ls56Y'></tfoot><dl id='Ls56Y'><fieldset id='Ls56Y'></fieldset></dl></div>

            <small id='Ls56Y'></small><noframes id='Ls56Y'>

              <tbody id='Ls56Y'></tbody>
              <tfoot id='Ls56Y'></tfoot>
                  <bdo id='Ls56Y'></bdo><ul id='Ls56Y'></ul>
                  本文介绍了我可以使用单个 python 脚本来创建 virtualenv 并安装 requirements.txt 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试创建一个脚本,如果尚未创建 virtualenv,我将在其中创建它,然后在其中安装 requirements.txt.

                  I am trying to create a script where i create a virtualenv if it has not been made, and then install requirements.txt in it.

                  我无法调用正常源/env/bin/activate并激活它,然后使用pip安装requirements.txt.有没有办法激活 virtualenv,然后从单个 python 脚本安装我的要求?

                  I can't call the normal source /env/bin/activate and activate it, then use pip to install requirements.txt. Is there a way to activate the virtualenv and then install my requirements from a single python script?

                  我现在的代码:

                      if not os.path.exists(env_path):
                          call(['virtualenv', env_path])
                  
                      else:
                          print "INFO: %s exists." %(env_path)
                  
                  
                  
                      try:
                          call(['source', os.path.join(env_path, 'bin', 'activate')])
                  
                      except Exception as e:
                          print e
                  

                  错误是没有这样的文件目录"

                  the error is "No such file directory"

                  谢谢

                  推荐答案

                  source 是 shell 内置命令,不是程序.它不能也不应该用 subprocess 执行.您可以通过在当前进程中执行 activate_this.py 来激活新的虚拟环境:

                  source is a shell builtin command, not a program. It cannot and shouldn't be executed with subprocess. You can activate your fresh virtual env by executing activate_this.py in the current process:

                  if not os.path.exists(env_path):
                      call(['virtualenv', env_path])
                      activate_this = os.path.join(env_path, 'bin', 'activate_this.py')
                      execfile(activate_this, dict(__file__=activate_this))
                  
                  else:
                      print "INFO: %s exists." %(env_path)
                  

                  这篇关于我可以使用单个 python 脚本来创建 virtualenv 并安装 requirements.txt 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                  Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)

                  • <bdo id='LfTM2'></bdo><ul id='LfTM2'></ul>

                    <small id='LfTM2'></small><noframes id='LfTM2'>

                      <tbody id='LfTM2'></tbody>
                    <legend id='LfTM2'><style id='LfTM2'><dir id='LfTM2'><q id='LfTM2'></q></dir></style></legend>
                    <i id='LfTM2'><tr id='LfTM2'><dt id='LfTM2'><q id='LfTM2'><span id='LfTM2'><b id='LfTM2'><form id='LfTM2'><ins id='LfTM2'></ins><ul id='LfTM2'></ul><sub id='LfTM2'></sub></form><legend id='LfTM2'></legend><bdo id='LfTM2'><pre id='LfTM2'><center id='LfTM2'></center></pre></bdo></b><th id='LfTM2'></th></span></q></dt></tr></i><div id='LfTM2'><tfoot id='LfTM2'></tfoot><dl id='LfTM2'><fieldset id='LfTM2'></fieldset></dl></div>

                            <tfoot id='LfTM2'></tfoot>