繁体   English   中英

我开始相信我的python安装已损坏

[英]I'm starting to believe that my python installation is broken

怎么会这样

/home/gui/Documents/GIT/Neuraxle/neuraxle/hyperparams/distributions.py in rvs(self)
    282         :return: an integer.
    283         """
--> 284         return round(float(self.hd.rvs()))
    285 
    286     def narrow_space_from_best_guess(self, best_guess, kept_space_ratio: float = 0.5) -> 'Quantized':

TypeError: type numpy.ndarray doesn't define __round__ method

今天,我收到了很多类似这样的奇怪错误。 不,我没有做过像float = np.array这样的愚蠢的float = np.array float方法是原始方法。 使用python 3.6.7。

注意:我正在编码的库以可编辑模式安装,例如: sudo -H pip3 install --editable . 可编辑的安装似乎失败,并使用sudo -H pip3 install --upgrade --force-reinstall --editable . 仅暂时解决问题。

事实证明该库是以可编辑模式安装的,这在编辑时给.pyc文件造成了一些麻烦。 如果有人遇到此问题,这里是解决方法。 要运行此程序,您应该位于“ setup.py”所在的文件夹中,并且位于git存储库中:

# Remove all .pyc files in the current git project
find $(git rev-parse --show-cdup) -name "*.pyc" -delete

# Completely reinstall the project
pip install --upgrade --force-reinstall --editable .

编辑:如果您可以避免完全以可编辑模式安装项目,那就更好了。 因此,跳过重做pip install --upgrade --force-reinstall --editable . 理想地。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM