简体   繁体   English

.bash_profile在终端中读取但不在PyCharm中读取

[英].bash_profile read in the terminal but not in PyCharm

very simple python run through in Terminal python, but failed in PyCharm. 非常简单的python在Terminal python中运行,但在PyCharm中失败。 Based on the message, the PATH I defined in the .bash_profile is not passed in PyCharm. 根据该消息,我在.bash_profile中定义的PATH不会在PyCharm中传递。 How do I let PyCharm know these PATH? 如何让PyCharm知道这些路径?

The correct result in Terminal Python: Terminal Python中的正确结果: 在此处输入图片说明

The failure I see in PyCharm: 我在PyCharm中看到的失败: 在此处输入图片说明

This is what worked for me for a somewhat similar scenario: 这对我来说在有些类似的情况下起作用:

  • I copied .bash_profile into .bashrc 我将.bash_profile复制到.bashrc
  • In Pycharm's Terminal settings, make sure that the 'Shell integration' option is not checked 在Pycharm的终端设置中,确保未选中“外壳集成”选项
  • I left 'Shell path' to only have the path to bash (no further --rcfile arguments required) 我离开了“ Shell路径”,仅拥有bash的路径(不需要其他--rcfile参数)

It may help to add an echo with a custom message in your .bashrc file to confirm if indeed this file is being read 在您的.bashrc文件中添加带有自定义消息的回显可能有助于确认是否确实正在读取此文件

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

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