(Python,Windows)如何在不进入高级设置的情况下将新文件夹添加到路径上?从命令行?
我正在工作中练习Python编码,目前正在研究一个小网络刮擦脚本。但是,我一直遇到一个问题,即Selenium Webdriver不在路径上,因此上次我在线时,我找到了一种进入命令行的方法,
echo %PATH%
该命令行显示了所有目录。然后,我能够添加一个新的,这是我的Webdriver Exes所在的位置。我知道现在我可以将Chrome Webdriver插入显示的目录之一,但我真的想弄清楚我如何做到这一点。不幸的是,我在网上讨论的所有指南都将进入高级系统设置,不幸的是,由于工作计算机的许可,我被锁定了。但是,我很想能够不断地解决它。任何帮助将不胜感激!
谢谢!
I'm practicing python coding in my free time at work and am currently working on a little web scraping script. However, I kept running into an issue where the selenium webdriver wasn't in the PATH, and so last time I was online I found a way to go to the command line, type
echo %PATH%
which showed me all my directories. Then, I was able to add a new one which was where my webdriver exes were located. I realize now I could have just plopped the chrome webdriver into one of the directories shown, but I really want to figure out how I was able to do that. Unfortunately, all the guides I find online discuss going into Advanced System Settings, which unfortunately I'm locked out of due to work computer permissions. However, I'd love to be able to keep messing around with it. Any help would be greatly appreciated!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望从Windows命令提示符设置一个环境变量,则可以使用 setx 命令:
当您以这种方式设置时,您将不会看到新值,您需要关闭CMD并再次打开。
If you wish to set an environment variable from Windows Command Prompt, you can do so using the setx command:
You won't see the new value when you echo %PATH% just after setting it this way, you need to close cmd and open it again.