简体   繁体   English

pycharm 看不到 python3.7 解释器

[英]pycharm doesn't see python3.7 interpreter

I'm using Pycharm Community 2018.1.4 on Linux Mint 19 Tara Xfce.我在 Linux Mint 19 Tara Xfce 上使用 Pycharm Community 2018.1.4。

It works well with Python 3.5 interpreter.它适用于 Python 3.5 解释器。 I installed Python 3.7 to be the default Python interpreter on the system.我安装了 Python 3.7 作为系统上的默认 Python 解释器。

python -V command returns Python 3.7.0b3 I would like to use Python 3.7 in Pycharm. python -V命令返回Python 3.7.0b3我想在 Pycharm 中使用 Python 3.7。

I've tried :我试过了 :

which python

/usr/bin/python

which python3.7

/usr/local/bin/python3.7

When I go to File > Settings > Project and Interpreter > Add and there is no /usr/local folder and there is no python3.7 in /usr/bin当我转到File > Settings > ProjectInterpreter > Add并且没有/usr/local文件夹并且/usr/bin没有 python3.7 时

I can cd to /usr/local/bin folder in the terminal, but Pycharm just can't.我可以cd到终端中的/usr/local/bin文件夹,但 Pycharm 不能。 I restarted, uninstalled/reinstalled Pycharm, refreshed its inner browser, restarted my pc.我重新启动,卸载/重新安装 Pycharm,刷新其内部浏览器,重新启动我的电脑。 Nothing changed.没有改变。

What am I missing?我错过了什么?

You will need to add the interpreter to the list of available interpreters.您需要将口译员添加到可用口译员列表中。

Use which python to find out the path of the interpreter, then in the Settings > Project Interpreter > Add > System Interpreter window hit the "..." button and add that interpreter.使用which python找出解释器的路径,然后在 Settings > Project Interpreter > Add > System Interpreter 窗口中点击“...”按钮并添加该解释器。 (The screenshot below is from macOS, but it should be the same on Linux.) (下面的截图来自 macOS,但在 Linux 上应该是一样的。)

在此处输入图片说明

I had the same issues with Pycharm Community Edition 2020.1, Linux Mint 19.3.我在 Pycharm 社区版 2020.1、Linux Mint 19.3 上遇到了同样的问题。

For reasons I don't know, the Flatpak version, which is only provided in Linux Mint's repositories can't see and access most of the directories which are beyond the user's home.由于我不知道的原因,仅在 Linux Mint 的存储库中提供的 Flatpak 版本无法查看和访问用户家以外的大多数目录。

Pycharm 2020.1 Flatpak comes with a Python 3.7 interpreter, which seems to live in the virtual environment, located in the user's home. Pycharm 2020.1 Flatpak 自带了一个 Python 3.7 解释器,它似乎生活在虚拟环境中,位于用户家中。 I tried to change for the default python3 compiler of Linux Mint 19.3, which is version 3.6 and lives in /usr/bin - no chance, neither by navigating with Pycharm's file browser, nor by copy and paste to the path field.我尝试更改 Linux Mint 19.3 的默认 python3 编译器,它是 3.6 版并且位于 /usr/bin - 没有机会,既不是通过使用 Pycharm 的文件浏览器导航,也不是通过复制和粘贴到路径字段。

Strangely also most of the directories eg below /usr/lib weren't displayed.奇怪的是,大多数目录(例如 /usr/lib 下方的目录)都没有显示。

I then installed Pycharm via a ppa (alternative package repository for some Linux flavors), to be specific this one然后我通过 ppa(某些 Linux 风格的替代软件包存储库)安装了 Pycharm,具体来说就是这个

Voilà!瞧! Any installed interpreter is accessible and can be selected.任何已安装的解释器都可以访问和选择。

How do you launch Python3.7 in terminal?你如何在终端中启动 Python3.7? For example, you use python3.7 to launch.比如你用python3.7启动。

Then you can which python3.7 to find where it is.然后你可以用which python3.7来查找它在哪里。

And then add that path to your Pycharm's Python Interpreter.然后将该路径添加到 Pycharm 的 Python 解释器中。

if you already have 3.7 installed.如果您已经安装了 3.7。 right click and run Pycharm as admin.右键单击并以管理员身份运行 Pycharm。 then it should display, and install the new packages.然后它应该显示并安装新软件包。

In flatpak-version PyCharm you can found host-os files in this directory:在 flatpak-version PyCharm 中,您可以在此目录中找到 host-os 文件:

/var/run/host/

For example:例如:

/var/run/host/usr/bin/python3.8

But this is a bad way.但这是一个糟糕的方式。 It is better to install from the ppa.最好从 ppa 安装。

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

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