pycharm

Why do I get a list of errors when trying to load matplotlib in PyCharm with the Anaconda environment?

↘锁芯ラ 提交于 2020-06-25 00:38:10
问题 I have installed PyCharm with Anaconda. I installed numpy fine using the PyCharm settings by adding the package via the Project Interpreter tab. However I am now trying to install matplotlib and I get a list of errors. Just by including the line import matplotlib.pyplot as plt I get the errors: AttributeError: module 'matplotlib.pyplot' has no attribute 'switch_backend' Matplotlib support failed Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev

Debugger times out at “Collecting data…”

≯℡__Kan透↙ 提交于 2020-06-24 06:01:12
问题 I am debugging a Python ( 3.5 ) program with PyCharm ( PyCharm Community Edition 2016.2.2 ; Build #PC-162.1812.1, built on August 16, 2016 ; JRE: 1.8.0_76-release-b216 x86 ; JVM: OpenJDK Server VM by JetBrains s.r.o ) on Windows 10. The problem: when stopped at some breakpoints, the Debugger window is stuck at "Collecting data", which eventually timeout. (with Unable to display frame variables ) The data to be displayed is neither special, nor particularly large. It is somehow available to

How to properly annotate a ContextManager in PyCharm?

本秂侑毒 提交于 2020-06-23 06:44:25
问题 How can I annotate the yield type of a contextmanager in PyCharm so that it properly guesses the type of the value used in the with clauses - just as it guesses that the f created in with open(...) as f is a file? For example, I have a context manager like this: @contextlib.contextmanager def temp_borders_file(geometry: GEOSGeometry, name='borders.json'): with TemporaryDirectory() as temp_dir: borders_file = Path(dir) / name with borders_file.open('w+') as f: f.write(geometry.json) yield

Pycharm- can not install opencv

痴心易碎 提交于 2020-06-17 09:51:07
问题 I am new to PyCharm, and try to understand how I can install openCV package, and later cv2 package. I saw an old disussion here, that suggets first to donwload the openCV from interent and then update the system interpreter. I download the openCV and loacted it on the same directorty where I manage my project. Is it good?? Many many thanks!! enter image description here 回答1: Just one line: pip install opencv-python or pip3 install opencv-python You can also: 回答2: You can read the instructions

Access denied when attempting to remove printer

痴心易碎 提交于 2020-06-17 05:07:39
问题 def on_printer_button_clicked(self, button): for i in range(len(self.printer_buttons)): if button == self.printer_buttons[i]: pHandle = win32print.OpenPrinter(self.printers[i]['pPrinterName']) win32print.DeletePrinter(pHandle) return So all I'm doing is opening the printer handle and calling the function Delete Printer, as you can see. Here's what I get in the console when I run the function: uninstall_windowGUI.py", line 57, in on_printer_button_clicked win32print.DeletePrinter(pHandle)

Access denied when attempting to remove printer

好久不见. 提交于 2020-06-17 05:06:53
问题 def on_printer_button_clicked(self, button): for i in range(len(self.printer_buttons)): if button == self.printer_buttons[i]: pHandle = win32print.OpenPrinter(self.printers[i]['pPrinterName']) win32print.DeletePrinter(pHandle) return So all I'm doing is opening the printer handle and calling the function Delete Printer, as you can see. Here's what I get in the console when I run the function: uninstall_windowGUI.py", line 57, in on_printer_button_clicked win32print.DeletePrinter(pHandle)

How to source additional environment in pycharm?

南笙酒味 提交于 2020-06-17 02:01:18
问题 I have a ROS application which has a work space with a setup.bash file and another python script with its own virtual environment. So far this is what I do in my terminal: 1_ pipenv shell (to activate my python virtual environment). 2_ source ../ros_workspace/devel/setup.bash 3_ python some_python_script.py This code works as I expect. However, I want to do the same and run this script in pycharm, where my virtual environment is already activated. But how do I source the setup bash

How to source additional environment in pycharm?

主宰稳场 提交于 2020-06-17 01:59:28
问题 I have a ROS application which has a work space with a setup.bash file and another python script with its own virtual environment. So far this is what I do in my terminal: 1_ pipenv shell (to activate my python virtual environment). 2_ source ../ros_workspace/devel/setup.bash 3_ python some_python_script.py This code works as I expect. However, I want to do the same and run this script in pycharm, where my virtual environment is already activated. But how do I source the setup bash

PEP 8: comparison to True should be 'if cond is True:' or 'if cond:'

随声附和 提交于 2020-06-16 05:47:47
问题 PyCharm is throwing a warning when I do np.where(temp == True) My full code: from numpy import where, array a = array([[0.4682], [0.5318]]) b = array([[0.29828851, 0., 0.28676873, 0., 0., 0., 0., 0.28801431, 0., 0., 0.71283046, 0.], [0.70171149, 0., 0.71323127, 0., 0., 0., 0., 0.71198569, 0., 0., 0.28716954, 0.]]) temp = b > 1.1*a pos = where(temp == True) print(pos) The code does not work as expected if I change temp == True to temp is True as suggested in other post. How should this warning

How to stop pycharm show files in project in red color?

淺唱寂寞╮ 提交于 2020-06-14 07:27:33
问题 I would like to create project in PyCharm by open directory. I use https://github.com/metachris/tornado-boilerplate as a root of the project. I encountered that files are shown in red color in project window. It's really annoying thing. I found this https://www.jetbrains.com/idea/help/file-status-highlights.html. But I can't figure out how to get rid of the issue. When I open empty directory and then create file just $ touch file It's color is red too. Thanx. 回答1: Did you start you project