没有 pyvenv.cfg 文件 [英] No pyvenv.cfg file

查看:75
本文介绍了没有 pyvenv.cfg 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个变量 cfg = waterot.cfg 然后在 pycharm 中创建了一个新文件waterot.cfg",这会自动创建一个 pyvenv.cfg 文件,我不知道这是什么,我的代码出错了我删除了 pyvenv.cfg 文件并从 .cfg 更改为 <代码>.txt.现在,当我运行代码时,出现错误 No pyvvenv.cfg file

I made a variable cfg = waterot.cfg and then made a new file "waterot.cfg" in pycharm, this automatically made a pyvenv.cfgfile, I didn't know what this was and I was getting errors with my code I deleted the pyvenv.cfg file and changed from .cfg to .txt. Now when I run my code I get an error No pyvvenv.cfg file

这是一段有问题的代码

redeemkey = message.author
if redeemkey.startswith('!download'):
    if message.channel.id == 695834994064490658:
        with open ('waterOT.txt', 'rb') as otcfg:
            await message.author.send(file=discord.File(otcfg, 'waterOT.cfg'))
        await message.delete()

推荐答案

如果你知道用于创建虚拟环境的 python 发行版的路径,以及它的版本,你可以自己创建一个 pyvenv.cfg 包含以下内容的文件

If you know the path for the python distribution used to create the virtual environment, and it's version, you can just create yourself a pyvenv.cfg file with following contents

home = <location-of-python-exe>
include-system-site-packages = false
version = <version>

哪里

  • 是用于创建 python 虚拟环境的 python.exe 所在的文件夹.示例 C:\Python\Python385-64.
  • 是 python 的版本,位于 .您可以通过运行 \python.exe 来检查它.示例:3.8.5.
  • <location-of-python-exe> is the folder where the python.exe is located that was used to create the python virtual environment. Example C:\Python\Python385-64.
  • <version> is the version of the python, at <location-of-python-exe>. You can check it by running <location-of-python-exe>\python.exe. Example: 3.8.5.

pyvenv.cfg 的有效位置是 (PEP405):

Valid locations for the pyvenv.cfg are (PEP405):

  • 在 python 可执行文件 (venv/Scripts/pyvenv.cfg) 旁边,即与 python.exe 位于同一文件夹中.
  • python 可执行文件的上一级目录;虚拟环境的根目录 (venv/pyvenv.cfg)
  • Next to the python executable (venv/Scripts/pyvenv.cfg), i.e. in the same folder with python.exe.
  • One directory up from the python executable; root of the virtual environment (venv/pyvenv.cfg)

其中 venv 是虚拟环境的假定名称(也可以是其他名称).

where venv is the assumed name of the virtual environment (could be something else, too).

这篇关于没有 pyvenv.cfg 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆