简体   繁体   English

从pycharm启动命令行并设置环境变量

[英]Launch command line from pycharm with environment variables set

是否可以从pycharm启动命令行提示符,该命令行提示符已经为我的项目自定义环境设置了所有环境变量(IE PYTHONPATH)。

If you go to Run -> Edit Configurations in PyCharm, this will let you set CLI arguments, and there's also a couple of different PYTHONPATH-related fields ( Add content roots to PYTHONPATH , Add source roots to PYTHONPATH ). 如果转到PyCharm中的Run -> Edit Configurations ,这将允许您设置CLI参数,并且还有几个不同的PYTHONPATH相关字段( Add content roots to PYTHONPATHAdd source roots to PYTHONPATH )。 You can also right-click a folder under the Project menu and check Mark as Sources Root - which I believe adds this directory to the PYTHONPATH at PyCharm script run-time. 您也可以右键单击“项目”菜单下的文件夹,然后选中“ Mark as Sources Root目录”-我相信可以在PyCharm脚本运行时将此目录添加到PYTHONPATH中。

Also, like metsfansaid, you could create a batch file to populate your Windows PYTHONPATH environmental variables prior to running anything in the new environment. 另外,就像metsfansaid一样,您可以创建一个批处理文件来填充Windows PYTHONPATH环境变量,然后再在新环境中运行任何东西。 I believe PyCharm will inherit those. 我相信PyCharm会继承这些。

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

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