python-3.x - Python/MVS - 调用标准库模块

标签 python-3.x visual-studio standard-library

我正在尝试在 Microsoft Visual Studio(Python 3.6,64 位)上运行以下代码并收到错误消息“标准库模块在导入期间调用用户代码;为调用的代码禁用断点”

我真的希望你能帮助我。我没有 MVS 的经验。
谢谢!!

请在下面找到我的代码:

Newton raphson method.
from __future__ import division
from unittest.test.test_result import __init__
import numpy as np
import matplotlib.pyplot as plt
from cplane_np import ArrayComplexPlane
from math import sqrt

####################################################################
class NewtonRaphson(ArrayComplexPlane):
"""define a class called NewtonRaphson which is a subclass from     
ArrayComplexPlane"""
def __init__(self):
    ArrayComplexPlane.__init__(self, -2, 2, 401, -2, 2, 401)
    self.z= ArrayComplexPlane(-2, 2, 401, -2, 2, 401).plane
    om=self.z
    om1= om.as_matrix()
    self.resu= self.meth2()
    ###Array of roots and iterations.

self.plo= self.plo_res()

def meth1(self,z0=3):


    x0=z0    #The initial value.
    n=0    # The initial value of iterations.
    dx=0.01
    dy=0.01
    eps=sqrt(dx**2+dy**2)

    while df(x0)!=0:    #the derivation of f(x) should be not equal to zero.

        n+=1
        #x1=self.apply(new_fun(x0))
        x1= new_fun(x0)
        if abs(x1-x0)< eps: #The condition to stop the iteration
            return (x1,n)
        else:
            x0=x1   #assign new value of x1 to x0

def meth2(self):
    ve= np.vectorize(self.meth1 )
    return ve(self.z)

def plo_res(self):
    res1=self.resu
    res_11= np.array(res1[0],dtype='float')
    plt.imshow(res_11)
    return plt.show()

Output

最佳答案

供将来引用:预计将在 Visual Studio 2017 15.6 中修复

https://github.com/Microsoft/PTVS/issues/3408

要在它出现之前解决这个问题,请遵循上面 github 线程中发布的建议:

If you'd like to try it right now, you should be able to overwrite your copy of debugger.py with the latest version at https://github.com/Microsoft/PTVS/blob/master/Python/Product/PythonTools/ptvsd/debugger.py

(search for debugger.py under your microsoft visual studio install directory)

It's possible that these warnings may have been the cause of the "debugger operation in progress" or made it much worse.

关于python-3.x - Python/MVS - 调用标准库模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46877938/

相关文章:

Python 日志记录不适用于模块

python - 将包含 Pandas DataFrame 列表列表的单元格解包到新 DataFrame 的单独行和列中

python - 使用 Enum Functional API 的意外警告 - PyCharm 错误

c++ - GCC 与 Windows SDK?

.net - IsNumeric 在评估对象时抛出 FormatException

python - 是否有与 `sum()` 内置函数等效的使用增强赋值的函数?

c++ - C++ 标准库中 `at()` 索引函数的真实用例?

c++ - stringstream 内部是如何工作的?

python - 无法解决以10为底的int()的基本错误无效文字

c# - 在 Visual Studio Code for Mac 上找不到任何 CSX 文件