Tag Archives: pycharm

Pychar report Python package tools not found error

Detailed map traversal, teach you to master the complex gremlin query debugging method>>>

Using pychar development, the machine is archlinux, installed with two versions of python2.7 and python3.7

But

Pychar report Python package tools not found error in pyhton interpreter report of python2.7

Reason: the PIP installed in the system has gone to the relevant directory of Python 3, and the pip of Python 2 is missing

Therefore, you also need to install the PIP corresponding to python2 version:

sudo pacman -S python-pip python2-pip 

(1) In a particular position, in a particular position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position, in a position,

(2) Of

By Sven Augustus

(2) Of

department

No r interpreter defined appears under pychar

When installing pychar for Python development, you often prompt no r interpreter defined in the lower right corner. Processing method:
1. Install R, and then add the path of R to pychar:

2. If you don’t need R language development, just uninstall R language plug-in:

and restart pychar

Steps:

Method 1: select the installation of R, and then add the path of R to pychar:

① open the comprehensive R archive network of R language

② download according to the corresponding system

③ download and install. Basically, click “next” to complete the installation

④ add the installation path of R to pychar

files – > Settings-> Languages & Frameworks-> R language

⑤ finally, click “OK” to complete the path configuration of R language

⑥ restart pychar, and the red warning will not be displayed in the open interface. So far, the problem is solved

method 2. If R is not needed in the development process, uninstall the R language plug-in directly

files – > Settings-> Plugins-> R Language Support-> Uninstall

Pychar yellow wavy line prompt: simplify chained comparison

A super detailed tutorial: springboot integrates mybatis plus>>>

It can simplify the chain comparison

case 1

if a >= 0 and a <= 9:

1

It can be simplified as follows:

if 0 <= a <= 9:

1

It’s like our mathematical expressions. Obviously, this situation only applies to the and situation

case 2

if score > 100 and score < 0:

1

It will be simplified as:

if 100 < score < 0:

1

Obviously, it’s also a fake. It’s not surprising pycharm is not smart enough, but you’ve written the expression wrong

if score > 100 or score < 0:

The solution to the problem of unified does not match any outer indentation level in pychar platform

Python has strict requirements for indentation

If you pay attention to it a little bit, you will get the error of unified does not match any outer indentation level


1. The indent before and after the code is inconsistent

You can see that there is a small red wavy line in front of def, which indicates that there is an indentation error here. Obviously, the indentation of the annotation in front of DEF is inconsistent with that of def (one is 2 and the other is 4). Just change it to be consistent

2. The indent before and after the code is inconsistent

In the figure above, the indent in front of the definitions of the two functions are the same, but an error prompt appears after x = 3, which indicates that an indent error has occurred near the sentence (before and after). Move the mouse to the highlighted yellow area or the red wavy line error area, and the error message will be displayed

From the error message, we can see that x = 3 does not match the following indentation. Further, we can see the prompt in the second figure: discontinuous indentation, tab indentation in the previous line, and sapce indentation in this line. Obviously, it is OK to change the indentation in front of def test2 to tab

Also, change the indentation before y = 3

3. Mixing tab and space

Obviously, if you use space and tab to indent in front of a piece of code, an error will naturally occur. At this time, pychar will automatically judge and adjust according to your preset indentation value

The indentation value you set is set in the settings above, which is generally 4, and the figure above is 3

If you open someone else’s Python program or Python script, it is very likely that there will be an indentation error. At this time, you only need to modify the indentation amount of the error place. Or use global substitution to replace spaces and indents in your code

Use the shortcut key of crtl + H to replace

In the figure above, replace tab (\ T) with four spaces. Note that you need to check the regex option when replacing symbols. The green area in the figure is tab area, and the yellow area is space area

undertake MATLAB, Python and C + + programming, machine learning, computer vision theory implementation and guidance, undergraduate and master can, please contact QQ 757160542 for details

This article shares in the blog “Yu Xiaoyong” (CSDN).

The solution of unresolved reference in pychar

Just installed pychar, try to feel very good, I think this can calm down to experiment flash project. As a result, I typed the code according to the tutorial. Pychar always prompted me with “unresolved reference” in red. I was very depressed. It was clear that the code could run correctly. How could this kind of error occur

Red error prompt looked really upset, so I went to Baidu online for a circle, but I didn’t find a solution. Later, I saw someone encounter the same problem on stackoverflow, and successfully solved the problem according to the given method

In fact, it’s very simple. Right click on the directory, select mark directory as sources root, and add your project directory to sources root

Then, in the settings, check add source roots to pythonpath to add sources root to pythonpath

After the change of apply, there is no error prompt. Look

PS: when you use a template, you will also be prompted that you can’t find the template file. In fact, the code can run correctly. That’s why you set it in pychar. Here, you can also find the option of adding directory as template in the settings, and you can also set it to jinja2

Reference: unresolved reference issue in pycharm