简体   繁体   English

如何在 VsCode python 编码(Win10)上更改目录? 基本问题,但我试过了

[英]how to change directory on VsCode python coding (Win10)? Basical Question but i have tried

1This is my first question here, I mainly use VSCode as IDE, and often play Python codes, and I stuck here, '''这是我在这里的第一个问题,我主要使用VSCode作为IDE,经常玩Python代码,就卡在这里了,'''

#!/usr/bin/env python
import os,sys
print(os.getcwd())
print('__file__:', __file__)
fileP = str(__file__).replace("c:\\", "")
print(fileP)
*print(os.chdir("C:\\Users\\playf\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages\\tespy"))*

''' '''

Trackback is like below '''引用如下'''

File "C:\Users\playf\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\playf\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\Users\playf\.vscode\extensions\ms-python.python-2020.8.103604\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
    cli.main()
  File "c:\Users\playf\.vscode\extensions\ms-python.python-2020.8.103604\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 430, in main
    run()
  File "c:\Users\playf\.vscode\extensions\ms-python.python-2020.8.103604\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 267, in run_file
    runpy.run_path(options.target, run_name=compat.force_str("__main__"))
  File "C:\Users\playf\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 263, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\playf\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\playf\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\Users\playf\AppData\Local\Programs\Python\Python38\Lib\site-packages\line4py\setup.py", line 11, in <module>
    os.chdir()
**TypeError: chdir() missing required argument 'path' (pos 1)**

''' '''

I tried another typing of pass like '''我尝试了另一种类型的通行证,例如 '''

"C:\\Users\\playf\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages\\tespy"
"Users\\playf\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages\\tespy"
"/Users/playf/AppData/Local/Programs/Python/Python38/Lib/site-packages/tespy"
"Users/playf/AppData/Local/Programs/Python/Python38/Lib/site-packages/tespy"

''' '''

all is out, is this problem about escape sequence or what?一切都结束了,这个问题是关于转义序列还是什么?

Why Win10 for programming?为什么要用Win10来编程? You can install Ubuntu in 15 minutes and code fast and easily您可以在 15 分钟内安装 Ubuntu 并快速轻松地编写代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM