解决Windows系统下Python不能使用export指令的困扰

更新时间:2023-05-22 08:06:37 阅读: 评论:0

解决Windows系统下Python不能使⽤export指令的困扰export是linux系统下的指令,在window系统下不能使⽤,很不⽅便,本⽂复现了⼀下export的功能。
问题描述:
'export' 不是内部或外部命令
新建exporttest.py,代码如下:
import argpar
import sys
from pathlib import Path
parr = argpar.ArgumentParr()
诚信让生活更美好作文
parr.add_argument("--path", type=str, default="")
parr.add_argument("--deletepath", type=str, default="")
args = parr.par_args()
# sys.path.append(r'newlib_path')
if __name__ == '__main__':
exportpath = eval(repr(args.path).replace('\\', '\\\\'))
exportpathlist=exportpath.split('AND')
# print(pathlist)
狗叫声汪汪汪# utable)
deletepath = eval(repr(args.deletepath).replace('\\', '\\\\'))
deletepathlist = deletepath.split('AND')
filepath=sys.prefix+'\Lib\site-packages\myExportPath.pth'
file = Path(filepath)
if ists():
# print("File doesn't exist, this code will first create one and then add the paths")
虎斑猫湖南风俗with file.open('w') as f:
for path in exportpathlist:
f.write(path)
f.write("\n")
existingPaths = ad_text()
existingPathslist = filter(None, existingPaths.split('\n'))
with file.open('w') as f:  # 创建并写⼊。
for existingPath in existingPathslist:
deleteFlag=Fal
for path in deletepathlist:
if existingPath == path:
deleteFlag=True
break桌面小游戏
if deleteFlag==Fal:
f.write(existingPath)
f.write("\n")
existingPaths = ad_text()
print("The export paths are: \n"+existingPaths)
el:
# print("The file exists, this code will add the paths to the existing file")什么的自述作文
ad_text()
existingPathslist = filter(None,existingPaths.split('\n'))
with file.open('a') as f:
for path in exportpathlist:
existingFlag=Fal
for existingPath in existingPathslist:
if existingPath == path:
existingFlag=True
print("warning: the path "+path+" already exists")
print("warning: the path "+path+" already exists")
break
if existingFlag==Fal:
f.write(path)
中国最长的内流河f.write("\n")
existingPaths = ad_text()
existingPathslist = filter(None, existingPaths.split('\n'))
with file.open('w') as f:
for existingPath in existingPathslist:
deleteFlag = Fal
for path in deletepathlist:
if existingPath == path:
deleteFlag = True
break
if deleteFlag == Fal:
f.write(existingPath)
f.write("\n")
existingPaths = ad_text()
print("The export paths are: \n" + existingPaths)
# print(sys.path)
使⽤⽅法如下:
1、添加⼀条path
指令:
python exporttest.py --path XXXX  #XXXX为你需要export的路径
⽰例:他作文
2、 添加多条path,path中间⽤AND连接
指令:
python exporttest.py --path XXXXANDXXXX    #XXXX为你需要export的路径⽰例:
3、查看已经添加的path
指令:
python exporttest.py
⽰例:
4、删除⼀条path
指令:
python exporttest.py --deletepath XXXX  #XXXX为你需要删除的路径⽰例:
5、删除多条path,同2,中间⽤AND连接

本文发布于:2023-05-22 08:06:37,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/923159.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:equip的名词
标签:系统   作文   指令
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图