将目录添加到 PyCharm 中的 Python 路径?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48947494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Add directory to Python path in PyCharm?
提问by user32882
I want to be able to use the paraview.simple
library in PyCharm. I already have paraview installed in my computer. This package cannot be installed with pip
and there are no .whl files as far as I can tell. The website docsrecommend that the directory containing all the python files be added to PYTHONPATH.
我希望能够paraview.simple
在 PyCharm 中使用该库。我的电脑上已经安装了paraview。这个包不能安装,pip
据我所知没有 .whl 文件。网站文档建议将包含所有 python 文件的目录添加到 PYTHONPATH。
How do I add the relevant folder in PYTHONPATH on my PyCharm session, and keep it there by default, such that when I close out and reopen the paraview.simple
library is still available?
如何在 PyCharm 会话的 PYTHONPATH 中添加相关文件夹,并默认将其保留在那里,以便在我关闭并重新打开paraview.simple
库时仍然可用?
回答by FlyingTeller
You can add custom paths this way.
您可以通过这种方式添加自定义路径。
- Go to File->Settings->project Interpreter
- In the Project-Interpreter field, click the down facing arrow and select "show All"
- In that Menu, highlight your interpreter and then in the right menu, select the button "Show paths for the selected interpreter" (this is the last button)
- click the plus symbol to add your path
- 转到文件->设置->项目解释器
- 在 Project-Interpreter 字段中,单击向下的箭头并选择“全部显示”
- 在该菜单中,突出显示您的解释器,然后在右侧菜单中,选择“显示所选解释器的路径”按钮(这是最后一个按钮)
- 单击加号以添加您的路径
回答by Danijel
回答by Jai
- Use anaconda with Pycharm
- To install paraview with anaconda run the following command:
conda install -c conda-forge paraview
- If conda command is not recognized then register the Anaconda path to environment variable
- Now open pycharm and give the configuration path as the Anaconda path
- File -> Settings -> Project Interpreter
- In Project Interpreter give similar path : "C:\Users\username\Anaconda3\python.exe"
- 在 Pycharm 中使用 anaconda
- 要使用 anaconda 安装 paraview,请运行以下命令:
conda install -c conda-forge paraview
- 如果无法识别 conda 命令,则将 Anaconda 路径注册到环境变量
- 现在打开pycharm,将配置路径指定为Anaconda路径
- 文件 -> 设置 -> 项目解释器
- 在项目解释器中给出类似的路径:“C:\Users\username\Anaconda3\python.exe”