久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Python:“ModuleNotFoundError",但安裝了模塊?

Python: quot;ModuleNotFoundErrorquot;, but module is installed?(Python:“ModuleNotFoundError,但安裝了模塊?)
本文介紹了Python:“ModuleNotFoundError",但安裝了模塊?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我意識(shí)到這似乎是一個(gè)通用問題,但所有答案都指向同時(shí)安裝兩個(gè) python - 我已經(jīng)卸載了另一個(gè).

I realize this seems like a generic question, but all answers pointed to having two simultanious python installations - I already uninstalled the other one.

目前我從 PyCharm 2017.1.5 (windows 10) 運(yùn)行我的代碼,Python 解釋器設(shè)置為 Python 3.6.1 (C:Anaconda3python.exe),即我安裝了 Anaconda3,其中包括 matplotlib,并使用 Anaconda3-解釋器從 PyCharm 運(yùn)行.

Currently I run my code from PyCharm 2017.1.5 (windows 10) with Python interpreter set as Python 3.6.1 (C:Anaconda3python.exe), i.e. I installed Anaconda3, which includes the matplotlib, and run from PyCharm using the Ananconda3-interpreter.

我在 Anaconda Navigator 中檢查了 matplotlib 2.0.2 已安裝在環(huán)境中.

I've checked in Anaconda Navigator that matplotlib 2.0.2 is installed in the environment.

一個(gè)最小(非工作)示例:

A minimal (non-working) example:

import matplotlib.pyplot as plt

plt.plot(range(10))
plt.show()

返回以下錯(cuò)誤:

C:Anaconda3python.exe C:/Users/John/Documents/CPU/master/untitled/main11.py
Traceback (most recent call last):
  File "C:/Users/John/Documents/CPU/master/untitled/main11.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:Anaconda3libsite-packagesmatplotlibpyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "C:Anaconda3libsite-packagesmatplotlibcolorbar.py", line 34, in <module>
    import matplotlib.collections as collections
  File "C:Anaconda3libsite-packagesmatplotlibcollections.py", line 37, in <module>
    import matplotlib.lines as mlines
  File "C:Anaconda3libsite-packagesmatplotliblines.py", line 28, in <module>
    from matplotlib.markers import MarkerStyle
ModuleNotFoundError: No module named 'matplotlib.markers'

Process finished with exit code 1

兩周前運(yùn)行良好,但現(xiàn)在不行.據(jù)我所知,我沒有改變或更新任何東西.模塊加載正確,但似乎是模塊內(nèi)容發(fā)生了變化?如果是這樣:這是怎么發(fā)生的,我該如何解決?

This ran fine 2 weeks ago, but not now. To my knowledge, I didn't change or update anything. The module loads correctly, but it seems to be a change in the module content? If so: How did that happen and how can I fix it?

推薦答案

@ImportanceOfBeingErnest 引導(dǎo)我走向正確的方向.我在這里發(fā)布我的解決方案.其他人可能會(huì)找到答案.問題是磁盤扇區(qū)損壞 - 不太可能發(fā)生的偶然事件.

@ImportanceOfBeingErnest lead me in the right direction. I post my solution here s.t. others may find the answer. The problem was a corrupted disk sector - an unlikely event of chance.

問題確實(shí)出在 matplotlib 包本身.回想起來,問題的指針是預(yù)分發(fā)包中不應(yīng)該存在錯(cuò)誤.如果是這樣,則外部環(huán)境一定已損壞,問題不在于 Python 安裝本身.

The problem was indeed in the matplotlib-package itself. Retrospectively, pointers to the issue were that errors in pre-distributed packages should not exist. If they do, external circumstances must have corrupted and the problem is not with the Python-installation itself.

我通過 Anaconda Prompt 使用 conda remove matplotlib 卸載了 matplotlib,然后使用 conda install matplotlib 重新安裝.這給了我這個(gè)錯(cuò)誤:

I uninstalled matplotlib through Anaconda Prompt with conda remove matplotlib and re-installed with conda install matplotlib. This gave me this error:

(C:Anaconda3) C:UsersJohn>conda install matplotlib
[...]
ERROR conda.core.link:_execute_actions(337): An error occurred while installing package 'defaults::matplotlib-2.0.2-np112py36_0'.
OSError(22, 'Invalid argument') Attempting to roll back. 

OSError(22, 'Invalid argument')

在@Ernest 發(fā)表評(píng)論之前,我認(rèn)為這可能與 非 ASCII 在 PATH 或類似的.

Before @Ernest's comment, I thought it maybe had to do with non-ASCII in PATH or similar.

相反,我嘗試完全重新安裝 Anaconda3,重新啟動(dòng)后發(fā)現(xiàn)部分 Anaconda3 文件夾沒有被刪除(包含 matplotlib 的文件夾).

Instead I tried to reinstall Anaconda3 completely, restarted and found that part of the Anaconda3-folder weren't removed (the one containing the matplotlib).

手動(dòng)刪除它會(huì)導(dǎo)致 Windows 錯(cuò)誤 0x80070570.關(guān)注 ServerFault 上的這篇文章(對(duì) OP 的評(píng)論) 我進(jìn)行了檢查,然后從 Windows Explorer GUI 進(jìn)行了修復(fù):右鍵單擊 This PC 中的驅(qū)動(dòng)器 --> Properties --> Tab Tools --> Check(如果發(fā)現(xiàn)任何錯(cuò)誤,repair就會(huì)出現(xiàn)).

Deleting it manually gave a Windows error 0x80070570. Following this post on ServerFault (the comment to OP) I ran a check and afterwards a repair from Windows Explorer GUI: Right-click on the drive in This PC --> Properties --> Tab Tools --> Check (repair appears if any errors are found).

重新啟動(dòng)后,從頭開始重新安裝 Anaconda3 并再次重新啟動(dòng),我能夠再次運(yùn)行我的項(xiàng)目!

After some restarts, reinstalling Anaconda3 from scratch and restarting again, I was able to run my project again!

這篇關(guān)于Python:“ModuleNotFoundError",但安裝了模塊?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to install Selenium in a conda environment?(如何在 conda 環(huán)境中安裝 Selenium?)
get the CUDA and CUDNN version on windows with Anaconda installe(使用 Anaconda installe 在 Windows 上獲取 CUDA 和 CUDNN 版本)
How can I download Anaconda for python 3.6(如何下載適用于 python 3.6 的 Anaconda)
Using two different Python Distributions(使用兩個(gè)不同的 Python 發(fā)行版)
How can I install Anaconda aside an existing pyenv installation on OSX?(除了 OSX 上現(xiàn)有的 pyenv 安裝之外,如何安裝 Anaconda?)
Permanently set Python path for Anaconda within Cygwin(在 Cygwin 中為 Anaconda 永久設(shè)置 Python 路徑)
主站蜘蛛池模板: 亚洲成人精品在线 | 中文字幕免费在线看线人动作大片 | 亚洲国产欧美日韩在线 | 午夜免费网站 | 日韩精品在线观看视频 | www.色婷婷 | www.在线播放 | 国产天堂av| 天堂在线中文资源 | 日韩精品免费观看 | 久久精品国产视频 | 黄色三级av | 精品一区二区三区在线观看 | 91免费网 | 国产在线观看不卡 | 99热在线免费观看 | 99热精品在线观看 | 中文字幕日本在线 | 午夜在线观看视频网站 | 欧美不卡在线 | 日韩欧美三区 | 免费观看成人 | 国产黄在线观看 | 91精品在线播放 | 激情久久av | 在线婷婷| 成年人免费看片 | 91精品91久久久中77777 | 日韩免费一区二区 | 亚洲一区免费视频 | 成人在线免费网站 | 午夜精品久久久久久久99 | 色呦呦国产精品 | 高清一区二区三区 | 久久99热这里只频精品6学生 | 国产不卡在线视频 | 三级黄色网| 天堂av资源| 婷久久| 日韩在线免费观看视频 | 亚洲天天 |