Tag Archives: pycharm

[Solved] Pycharm Error: Error: failed to send plot to

pycharm error: Error: failed to send plot to
pycharm error: Error: failed to send plot to

#Machine learning using numpy implementation
import numpy as  np
from matplotlib import pyplot as plt
#Generate the input data x as well as the objective function y. Set the random number seed to allow for multiple methods of comparison



Go directly to pycharm setting – > tools——> Python scientific, then uncheck ☑ Show plot in tool windosw.

Solve the problem of pychart connecting MySQL 1366 and reporting an error

If you use pymysql to connect to MySQL, an error 1366 will be reported

engine=create_engine('mysql+pymysql://root:[email protected]/b',#Specify the database engine to connect to, e.g. MySQL, Oracle, etc.

Error reporting:

E:\Anacoda\lib\site-packages\pymysql\cursors.py:170: Warning: (1366, "Incorrect string value: '\\xD6\\xD0\\xB9\\xFA\\xB1\\xEA...' for column 'VARIABLE_VALUE' at row 497")
  result = self._query(query)


Download MySQL connector Python from the official MySQL website: https://dev.mysql.com/downloads/connector/python/

After downloading and installing, change pymysql in the original connection code to mysqlconnector

engine=create_engine('mysql+mysqlconnector://root:[email protected]/b',


Error when using input in pycharm

In python2, you can’t directly use input to obtain strings. You need to use raw_Input() , so the error may be the wrong version of Python and the wrong statement

Adjusting Python version in


  file–setting–project–project interpreter

Error reported by python console in Pycharm [How to Solve]

Error:Error:Cannot run program “E:\PythonProjects\venv\Scripts\python.exe” (in directory “E:\ProjectsHttpR”): CreateProcess error=2, system could not find the specified file.


1 file–setting–Project: project name–Project Interpreter–path select the python installation path.

2 file–setting–Buile,Execution,Depolyment–Console–Python Console–Python interpretr. path Select the installation path of python.


Error reporting of importing tensorflow package from pycharm

 [ Note] pycharm imports the tensorflow package and reports an error

If you also encounter this problem, it means you don’t understand where tensorflow is

After installing Anaconda 3.6, set interpreter in pycharm. This interpreter determines how to execute the code you write in pycharm environment

If your setting is python.exe under anaconda. You will find that import tensorflow is written in pycharm   When as TF, an error will be reported, indicating that there is no tensorflow module. This is because python.exe in Anaconda file is version 3.6, and the CONDA environment you created is under anaconda, and the tensorflow you installed is in CONDA environment, not Anaconda environment. Therefore, if you want to import tensorflow, you need to select python.exe in CONDA environment as the interpreter

When your interpreter selects python.exe under Anaconda in the red box shown in the figure below, you will be prompted that the tensorflow module is not found when importing tensorflow in pycharm environment


If you want to use tensorflow, the interpreter should choose the following path (Anaconda – > envs-> tenfowflow-> Python.exe under python. Exe)

The correct selection of the interpreter is shown in the figure. Click the setting button indicated by the arrow in the figure below, select add local, and select python.exe of the path shown in the figure above instead of python.exe under anaconda. After selecting python.exe under CONDA environment, the settings shown in the red box in the figure below will be displayed


Handling method of PIP error in pycharm installation

When using pycharm these days, I found that I reported it when installing the software  module ‘pip’ has no attribute ‘main’  , later, the online methods and analysis error prompts were integrated because there was a packaging in the pycharm installation directory_There are two pieces of code in the tool.py file. There are some problems with the configuration and some changes need to be made

The original code is as follows:

 1 def do_install(pkgs):
 3     try:
 4         import pip
 5     except ImportError:
 6         error_no_pip()
 7     return pip.main(['install'] + pkgs)
10 def do_uninstall(pkgs):
11     try:
12         import pip      
13     except ImportError:
14         error_no_pip()
15     return pip.main(['uninstall', '-y'] + pkgs)

Modify it to the following code:

 1 def do_install(pkgs):
 3     try:
 4         #import pip
 5             try:
 6                     from pip._internal import main   
 7             except Exception:
 8                     from pip import main
 9     except ImportError:
10         error_no_pip()
11     return main(['install'] + pkgs)
14 def do_uninstall(pkgs):
15     try:
16         #import pip
17             try:
18                   from pip._internal import main
19             except Exception:
20                   from pip import main        
21     except ImportError:
22         error_no_pip()
23     return main(['uninstall', '-y'] + pkgs)

If you report an error after modification, it may be a problem of indentation. You must pay attention to the indentation of the code. Python’s indentation requirements can be called abnormal


Solve the problem of error reporting when installing Python Library in pycharm

Recently, I was playing wechat Turing robot, but I installed some libraries, reported errors, and searched the Internet for a long time. I summarized two methods and recorded them


method 1:

Install manually, go directly to the official website and download the python library you need locally

Put it in the python installation path, C: \ users \ blue silver heart \ appdata \ local \ programs \ Python \ Python 37 \ lib \ venv \ scripts

PIP install – U library name



method 2:

Install in pycharm, but because many libraries are foreign and the domestic connection is not very friendly, some library installations will fail or fail to connect directly due to unstable network, such as






PIP source for domestic, I personally think Tsinghua source is relatively stable

Tsinghua source






Install again, successful




In comparison, it’s easier to install Python libraries automatically in Python. Manual installation is too cumbersome. I don’t like it


Error reporting of import basemap in pychar

The direct cause is that the system cannot find this proj_Lib environment variable, so an error is reported

Root cause: when calling the basemap module, the proj4 module that the basemap depends on will be called. Therefore, when installing the basemap module on anaconda, you can see that the proj4 module is also installed. But the most pitiful thing is that when installing proj4 under Anaconda root, you will not actively set the environment variables of proj4 module, which leads to such errors

Solution: first find the installation path of proj4 in Anaconda installation directory. Mine is in D: \ software \ Anaconda \ Pkgs \ proj4-4.9.3-hfa6e2cd_8. Then open this folder and enter library – > Share folder, select and copy all the files inside, and paste them into the folder D: \ software \ Anaconda \ share \ proj (if there is no proj folder in the root directory of anaconda, create one)

Then, set the environment variable, that is, create a new one under the user variable

Solve the problem of clear read only status move failure in pychar move file under win7

Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>

Problem Description:

If you move the files in pychar to the specified folder or drag other files to the specified folder in pychar, the following problems will occur, resulting in the failure of File Movement:

The causes and solutions of this problem are as follows:

First, the files created under pychar are read-only by default. We need to enter the attribute of the specified folder and remove the check of read-only

Second, there is a lock button in the lower right corner of pychar, which you need to click to open

Details of this lock can be found in the official document:

https://www.jetbrains.com/help/idea/2016.1/changing-read-only-status-of-files.html?origin=old_ help#d1969355e156