How can I force PyCharm to inspect the requirements.txt file and suggest updates?

血红的双手。 提交于 2020-06-09 15:56:56

问题


How can I force PyCharm to inspect the requirements.txt file and suggest updates? I can't seem to control when this happens. Thanks!


回答1:


Open any .py file after requirements.txt has been changed, PyCharm will parse requirements.txt and suggest updates, e.g. packages installation.




回答2:


I tried opening any .py file, checking Package requirements file field (Settings - Tools - Python Integrated Tools). Nothing triggered my PyCharm on Windows to detect a new dependency added to requirements.txt. Since the virtual environment was created with PyCharm's Add Local, trying to get pip to work for the virtual environment with a Windows command line also seemed quite a bit of work.

Finally, the easiest solution that worked for me was as follows.

  1. Click on the icon in the lower left corner. It brings up menus to Project, Python Console, Structure, TODO, etc. Find Terminal in it.

  2. Click on Terminal. It seems to be automatically virtual environment aware.

  3. Run pip install -r requirements.txt



回答3:


What worked for me is configuring explicitely the requirements.txt in PyCharm, as described in the doc



来源:https://stackoverflow.com/questions/38109322/how-can-i-force-pycharm-to-inspect-the-requirements-txt-file-and-suggest-updates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!