Home > Blockchain >  Can I ask a fundamental question about PyCharm base interpreter?
Can I ask a fundamental question about PyCharm base interpreter?

Time:01-09

I am trying to use Python3 with PyCharm.

So I installed Python(3.10.1) and PyCharm(2021.3.1)

But when I try to create a new project, PyCharm want me to choose 'base interpreter' and I don't know which one to choose.

Here is the list of base interpreter:
Here is the list of base interpreter

I want to know what is difference between /usr/bin/python3 and Library/Frameworks/Python.framework/Versions/3.10/bin/python3

Thank you in advance!

CodePudding user response:

Usually the files under /usr/bin/ are symlinks to actual files, which means they are not real files but links to the actual file.

To see it for yourself go to the /usr/bin/ directory with a terminal and execute:

ls -a

I suppose macOS already ships with python and by installing Python 3.10 you added that last element to the list, which is also linked by /bin/usr/python3.

I'd go with /usr/bin/python3, more portable.

CodePudding user response:

You can choose the one interpreter for the version of python you want. In your terminal, you can run python --version or python3 --version and it will display the version of python, Like this:

$ python --version
Python 2.7.16
$ python3 --version
Python 3.9.1

Performing which python, will give you the path to that python binary, like the following (although, this is where we are leaving "Python" and talking more about the OS and PATH.

$ which python3
/usr/local/bin/python3

For the other versions of Python you have installed, you can check their version by doing something like:

/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 --version

You'll find that you may choose different versions of python for different projects. In the future, you may consider using venv to setup virtual python environments per project.

If you're just getting started with Python, I'd suggest sticking with the version you installed 3.10.1, and choosing that interpreter.

CodePudding user response:

The base interpreter is the python.exe file that will run everything you do inside that project.

I would suggest you use Anaconda as a package manager and then create a virtual environment with the version of Python you need. Just follow these steps:

Getting started with Anaconda: https://docs.anaconda.com/anaconda/user-guide/tasks/pycharm/

Choosing an Anaconda virtual environment with Pycharm: https://docs.anaconda.com/anaconda/user-guide/tasks/pycharm/

A package manager like Anaconda is very useful when working with Python.

Otherwise: In your list you have many different versions of python. You should choose the base interpreter based on the python version you want to use.

CodePudding user response:

Always select the latest version.

Since I use Python 3.9, it will be:

/usr/local/bin/python3.9

Based on your image, it would be:

/usr/local/bin/python3

CodePudding user response:

The interpreter is what version your PyCharm project uses. It appears you have python2 and python3, so if you were writing in python2, you would use the python2 interpreter.

I would select the latest version, which in your case would be:

/usr/local/bin/python3
  •  Tags:  
  • Related