【问题标题】:I am trying to make a directory in the same one, where my file is but it makes it in "venv"我试图在同一个目录中创建一个目录,我的文件在哪里,但它在“venv”中
【发布时间】:2020-01-07 18:29:26
【问题描述】:

Here I try to create a directory in HelloWorld but it is making it in venv instead.

基本上,每次我想以任何方式创建、查找或与目录交互时,它指的是.\HelloWorld\venv 而不是.\HelloWorld

我怎样才能改变它?

【问题讨论】:

    标签: python python-3.x pycharm python-venv


    【解决方案1】:

    我猜你不需要使用 lib 来获取系统路径,'os' 包可以处理:

    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    os.mkdir(os.path.join(BASE_DIR, "YOUR_FOLDER_NAME"))
    

    【讨论】:

      【解决方案2】:

      可以通过Working directory设置在运行配置中指定,见https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html

      【讨论】:

        猜你喜欢
        • 2023-03-07
        • 1970-01-01
        • 2021-09-19
        • 1970-01-01
        • 2014-04-26
        • 2017-11-10
        • 1970-01-01
        • 2023-02-02
        • 1970-01-01
        相关资源
        最近更新 更多