由于種種原因spyder突然用不了了,于是進行了如下的神操作,發(fā)此貼記錄我的悲催歷程
看些有哪些spyder版本可以安裝
(base) C:\Users\Administrator>pip install spyder==*
ERROR: Could not find a version that satisfies the requirement spyder==* (from v
ersions: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5.2, 2.3.6, 2.3.7, 2.3.8, 2.3.9,
3.0.0b2, 3.0.0b3, 3.0.0b4, 3.0.0b5, 3.0.0b6, 3.0.0b7, 3.0.0, 3.0.1, 3.0.2, 3.1.
0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6,
3.2.7, 3.2.8, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.5, 3.3.6, 4.0.0b1, 4.0.0b2,
4.0.0b3, 4.0.0b4, 4.0.0b5, 4.0.0b6, 4.0.0b7, 4.0.0rc1, 4.0.0rc2, 4.0.0rc3, 4.0.
0, 4.0.1, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.1.6, 4.2.0, 4.2.1, 4.2.2,
4.2.3, 4.2.4, 4.2.5, 5.0.0a1, 5.0.0a2, 5.0.0a3, 5.0.0a4, 5.0.0a5, 5.0.0a6, 5.0.0
a7, 5.0.0)
ERROR: No matching distribution found for spyder==*
嘗試安裝spyder==4.1.6
pip install --use-feature=2020-resolver spyder==4.1.6 -i https://pypi.douban.com/simple
出現(xiàn)如下錯誤提示
ERROR: pyls-spyder 0.3.2 requires python-language-server>=0.36.2, but you'll hav
e python-language-server 0.34.1 which is incompatible.
distributed 2.30.1 requires cloudpickle>=1.5.0, but you'll have cloudpickle 1.3.
0 which is incompatible.
所以我們降低spyder的安裝版本試試
pip install --use-feature=2020-resolver spyder==3.3.6 -i https://pypi.douban.com/simple
WARNING: Error parsing requirements for python-language-server: [Errno 2] No suc
h file or directory: 'd:\\programdata\\anaconda3\\lib\\site-packages\\python_lan
guage_server-0.35.1.dist-info\\METADATA'
雖然安裝過程里面出現(xiàn)一些錯誤提示,但是最終還是說 Successfully uninstalled spyder-4.1.6
Successfully installed spyder-3.3.6 spyder-kernels-1.9.4 可以認為是安裝成功了
然后我們輸入spyder3執(zhí)行,彈出一個對話框
Spyder crashed during last session. .
If Spyder does not start at all and before submitting a bug report,
please try to reset settings to defaults by running Spyder with the
command line option '--reset':spyder --reset
Wa rning: this command will remove all your Spyder configuration files
located in 'C:\Users\Administrator\.spyder-py3).
If Spyder still fails to launch, you should consult our comprehensive
Troubleshooting Guide, which when followed carefully solves the vast
majority of crashes; also, take the time to search for known bugs or
discussions matching your situation before submitting a report to our
issue tracker. Your feedback will always be greatly appreciated.
因為之前沒有正確保存和退出程序,第二次打開出現(xiàn)如下這種情況:
我們點擊ok關(guān)閉這個提示窗口
然后輸入spyder3 --reset
沒有彈出那個錯誤提示,但是也沒有成功打開spyder
刪除這個文件"C:\Users\Administrator\.spyder-py3"
然后再啟動spyder
"C:\Users\Administrator\.matplotlib"
刪掉這個文件,然后再啟動spyder
然后輸入spyder3 --reset 發(fā)現(xiàn)這個命令只是起到生成上面刪除的那兩個文件的作用
然后輸入spyder3 回車后感覺spyder馬上可以打開的樣子,但是等了一會,那個出現(xiàn)的spyder打開界面又消失了。
還是無法啟動spyder
執(zhí)行pip check會有下面這個提示
(base) C:\Users\Administrator>pip check
WARNING: Error parsing requirements for spyder-kernels: [Errno 2] No such file o
r directory: 'd:\\programdata\\anaconda3\\lib\\site-packages\\spyder_kernels-1.9
.4.dist-info\\METADATA'
WARNING: Error parsing requirements for python-language-server: [Errno 2] No suc
h file or directory: 'd:\\programdata\\anaconda3\\lib\\site-packages\\python_lan
guage_server-0.35.1.dist-info\\METADATA'
我們?nèi)ノ募A看了有spyder_kernels-1.9.4.dist-info但是里面確實沒有METADATA文件夾
然后我們重新安裝 spyder-kernels庫
先把已有的spyder_kernels-1.9.4.dist-info spyder_kernels spyder_kernels-0.5.2.dist-info文件夾刪掉
然后重裝
pip install --use-feature=2020-resolver spyder-kernels==1.9.4 -i https://pypi.douban.com/simple
然后出現(xiàn)下面的錯誤提示
ERROR: spyder 3.3.6 requires spyder-kernels
kernels 1.9.4 which is incompatible.
Successfully installed spyder-kernels-1.9.4
然后我們先卸載裝好的spyder-kernels-1.9.4,然后重新裝指定版本
pip uninstall spyder-kernels 卸載成功了,文件夾也消失了
然后裝和spyder相匹配的版本
pip install --use-feature=2020-resolver spyder-kernels==0.5.0 -i https://pypi.douban.com/simple
然后我們再升級spyder
pip install --use-feature=2020-resolver spyder==3.3.6 -i https://pypi.douban.com/simple
然后再pip check
(base) C:\Users\Administrator>pip check
WARNING: Error parsing requirements for python-language-server: [Errno 2] No suc
h file or directory: 'd:\\programdata\\anaconda3\\lib\\site-packages\\python_lan
guage_server-0.35.1.dist-info\\METADATA'
pyls-spyder 0.3.2 requires python-language-server, which is not installed.
pyls-black 0.4.6 requires python-language-server, which is not installed.
tensorflow 2.4.1 has requirement numpy~=1.19.2, but you have numpy 1.20.2.
看來python-language-server有問題,那我們就重裝這個依賴庫
刪掉原有的兩個文件夾python_language_server-0.34.1.dist-info python_language_server-0.35.1.dist-info
這兩個文件是已經(jīng)損壞的文件是怎么損壞的呢。有可能你在安裝過程中突然中斷或者其他什么原因,導(dǎo)致兩個文件夾里的一些關(guān)鍵文
件丟掉了。
我們要手動刪除這兩個文件夾,然后再重新安裝
pip install --use-feature=2020-resolver python_language_server==0.35.1 -i https://pypi.douban.com/simple
安裝成功了,但是又版本不匹配的提示
ERROR: pyls-spyder 0.3.2 requires python-language-server>=0.36.2, but you'll hav
e python-language-server 0.35.1 which is incompatible.
Successfully installed python-language-server-0.35.1
我們卸載python_language_server==0.35.1然后重新裝python-language-server>=0.36.2
pip install --use-feature=2020-resolver python_language_server==0.36.2 -i https://pypi.douban.com/simple
裝python_language_server成功之后我們再運行
pip check
(base) C:\Users\Administrator>pip check
tensorflow 2.4.1 has requirement numpy~=1.19.2, but you have numpy 1.20.2.
發(fā)現(xiàn)沒有關(guān)于spyder的版本錯誤提示了。
接下來更新spyder,沒有發(fā)現(xiàn)錯誤提示
pip install spyder==3.3.6 update -i https://pypi.douban.com/simple
然后我們再啟動spyder3 --reset試試
然后輸入spyder3
還是過一會就關(guān)閉了,還是打不開
spyder setting up main window就失敗了
需要注意的地方是我們在安裝spyder庫的時候需要安裝一些依賴庫,
如果已有的依賴庫版本不對,那么在安裝spyder庫的過程中,他會卸載這些庫,然后安裝符合要求的版本庫。
但是如果想要卸載的庫已經(jīng)損害(或者是只剩下寫碎片),那你卸載就不能成功,因此也不能安裝成功。
這是我們需要把手動剩余的碎片文件夾刪掉,然后再安裝spyder
通過前面的操作我們已經(jīng)將那些損壞的文件刪掉了并且下載了新的版本,如果再遇到需要卸載庫的情況應(yīng)該會自動卸載和安裝。
接下來我們試一下安裝spyder4.2.5試試
pip install spyder==4.2.5 update -i https://pypi.douban.com/simple --user
成功安裝了spyder==4.2.5 也沒有出現(xiàn)錯誤提示,但是spyder還是無法啟動
有人說這是因為很多庫沒有更新導(dǎo)致的,因此執(zhí)行下面的命令
conda upgrade --all
升級并沒有完全升級成功
然后再啟動spyder,仍然是過一會就退出了。
然后卸載spyder重裝
pip uninstall
pip install spyder==4.2.5 update --use-feature=2020-resolver -i https://pypi.douban.com/simple --user
ERROR: -pyder 3.3.6 requires spyder-kernels
1.10.3
然后spyder3還是不能打開
然后重啟電腦試試
結(jié)果還是不能打開spyder
用記事本方式打開下面這個文件
"D:\ProgramData\Anaconda3\Lib\site-packages\tornado\platform\asyncio.py"
卸載spyder之后在navigator里面安裝spyder,結(jié)果提示
CondaHTTPError: HTTP 000 CONNECTION FAILED for url<https://repo.anaconda.com/pkgs/main/win-
64/repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors
are often intermittent, and a simple retry will get you on your way.
If your current network has
https://www.anaconda.com blocked, please file
a support request with your network engineering
team.
'https://repo.anaconda.com/pkgs/main/win-64'
這是什么意思?
這主要是anaconda延遲過高導(dǎo)致。
如何解決這個問題?
通過給.condarc文件添加國內(nèi)鏡像源的方式來解決延遲過高的問題。
執(zhí)行下面的命令
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
這樣就會把上面這個channel增加到.condarc文件里面
卸載spyder之后在navigator里面安裝spyder,
在那個窗口下方的狀態(tài)欄顯示installing application spyder on D:\ProgramData\Anaconda3
說明spyder是一個應(yīng)用。
然后我干了一會別的事,沒看電腦,竟然顯示安裝好了,我看看能不能用
我在navigator spyder下面點擊lanch,結(jié)果過會出現(xiàn)錯誤提示
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\lib\site-packages\astroid\astpeephole.py", line 17, in
_TYPES = (_ast.Str, _ast.Bytes)
AttributeError: module '_ast' has no attribute 'Str'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 205, in main
mainwindow.main()
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3651, in main
mainwindow = run_spyder(app, options, args)
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3526, in run_spyder
main.setup()
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 982, in setup
module = importlib.import_module(
File "D:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\pylint\__init__.py", line 14, in
from .plugin import Pylint as PLUGIN_CLASS
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\pylint\plugin.py", line 29, in
from spyder.plugins.pylint.confpage import (PylintConfigPage,
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\pylint\confpage.py", line 16, in
from spyder.plugins.pylint.widgets.pylintgui import PylintWidget
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\pylint\widgets\pylintgui.py", line 37, in
from spyder.plugins.pylint.utils import get_pylintrc_path
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\pylint\utils.py", line 16, in
import pylint.config
File "D:\ProgramData\Anaconda3\lib\site-packages\pylint\config\__init__.py", line 38, in
from pylint.config.configuration_mixin import ConfigurationMixIn
File "D:\ProgramData\Anaconda3\lib\site-packages\pylint\config\configuration_mixin.py", line 4, in
from pylint.config.option_manager_mixin import OptionsManagerMixIn
File "D:\ProgramData\Anaconda3\lib\site-packages\pylint\config\option_manager_mixin.py", line 16, in
from pylint import utils
File "D:\ProgramData\Anaconda3\lib\site-packages\pylint\utils\__init__.py", line 45, in
from pylint.utils.ast_walker import ASTWalker
File "D:\ProgramData\Anaconda3\lib\site-packages\pylint\utils\ast_walker.py", line 6, in
from astroid import nodes
File "D:\ProgramData\Anaconda3\lib\site-packages\astroid\__init__.py", line 67, in
from astroid.builder import parse, extract_node
File "D:\ProgramData\Anaconda3\lib\site-packages\astroid\builder.py", line 26, in
from astroid import rebuilder
File "D:\ProgramData\Anaconda3\lib\site-packages\astroid\rebuilder.py", line 17, in
from astroid import astpeephole
File "D:\ProgramData\Anaconda3\lib\site-packages\astroid\astpeephole.py", line 19, in
_TYPES = (_ast.Str, )
AttributeError: module '_ast' has no attribute 'Str'
然后我們再把安裝的spyder卸載了
用pip uninstall spyder
完成之后在navigator spyder下面還可以看到lanch,當然我們點進去肯定是不行的,我們右鍵點擊選擇remove application
感覺這個過程非常慢,現(xiàn)在是8:30我看幾點完成,8:36完成了。spyder下面又變成了install字樣
我們在.condarc文件里再添加一個鏡像源
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
把show_channel_urls參數(shù)值設(shè)定為yes
conda config --set show_channel_urls yes
在.condarc文件里把下面這一行手動刪掉
- defaults
然后.condarc文件就變成了如下內(nèi)容
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
ssl_verify: true
show_channel_urls: true
然后在cmd窗口執(zhí)行
conda update --all #修改鏡像源文件之后的升級速度明顯變快了。很快就完成了。
我們把這個文件夾刪掉 "C:\Users\Administrator\.spyder-py3"
然后重新安裝spyder
conda install spyder
C:\Users\Administrator>conda install spyder
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible so
lve.
Solving environment: failed with repodata from current_repodata.json, will retry
with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: \
Warning: 2 possible package resolutions (only showing differing packages):
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch::sphinx-3.5.3-
pyhd3eb1b0_0, http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64::doc
utils-0.17-py38haa95532_1
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch::sphinx-3.5.4-
pyhd3eb1b0_0, http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64::doc
utils-0.16-py38done
## Package Plan ##
environment location: D:\ProgramData\Anaconda3
added / updated specs:
- spyder
The following packages will be downloaded:
The following packages will be DOWNGRADED:
parso 0.8.2-pyhd3eb1b0_0 --> 0.7.0-py_0
Proceed ([y]/n)?
不知道上面說的那些Solving environment warning是否會安裝產(chǎn)生嚴重影響
我們根據(jù)提示輸入y繼續(xù)
接下來很快就安裝完成了
然后我們啟動spyder3試試,輸入spyder3說不能識別,因此我們輸入spyder,結(jié)果還是有下面的錯誤提示
C:\Users\Administrator>spyder
No QCoreApplication instance found. Application patches not applied. You have to
call load_stylesheet function after instantiation of QApplication to take effec
t.
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", li
ne 2146, in create_window
main.setup()
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", li
ne 737, in setup
from spyder.plugins.help.utils.sphinxify import CSS_PATH, DARK_CSS_PATH
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\help\__init__.
py", line 14, in
from spyder.plugins.help.plugin import Help
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\help\plugin.py
", line 23, in
from spyder.plugins.console.api import ConsoleActions
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\console\__init
__.py", line 17, in
from spyder.plugins.console.plugin import Console
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\console\plugin
.py", line 22, in
from spyder.plugins.application.plugin import ApplicationActions
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\application\__
init__.py", line 14, in
from spyder.plugins.application.plugin import Application
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\application\pl
ugin.py", line 26, in
from spyder.plugins.application.container import (
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\application\co
ntainer.py", line 37, in
from spyder.utils.environ import WinUserEnvDialog
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\environ.py", lin
e 19, in
from spyder.widgets.collectionseditor import CollectionsEditor
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\widgets\collectionsedi
tor.py", line 39, in
from spyder_kernels.utils.nsview import (
ImportError: cannot import name 'get_numpy_type_string' from 'spyder_kernels.uti
ls.nsview' (C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages
\spyder_kernels\utils\nsview.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 21
4, in main
mainwindow.main(options, args)
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", li
ne 2293, in main
mainwindow = create_window(app, splash, options, args)
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", li
ne 2148, in create_window
if main.console is not None:
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", li
ne 1159, in __getattr__
return self.get_plugin(self._INTERNAL_PLUGINS_MAPPING[attr])
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", li
ne 168, in get_plugin
raise SpyderAPIError('Plugin "{}" not found!'.format(plugin_name))
spyder.api.exceptions.SpyderAPIError: Plugin "internal_console" not found!
C:\Users\Administrator>
然后再navigator 里面啟動spyder試試(如果在spyder下面看不到lanch,可以refresh一下就可以看到了),提示如下錯誤,和上
面的錯誤提示是完全一樣的。
No QCoreApplication instance found. Application patches not applied. You have to call load_stylesheet function
after instantiation of QApplication to take effect.
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 2146, in create_window
main.setup()
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 737, in setup
from spyder.plugins.help.utils.sphinxify import CSS_PATH, DARK_CSS_PATH
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\help\__init__.py", line 14, in
from spyder.plugins.help.plugin import Help
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\help\plugin.py", line 23, in
from spyder.plugins.console.api import ConsoleActions
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\console\__init__.py", line 17, in
from spyder.plugins.console.plugin import Console
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\console\plugin.py", line 22, in
from spyder.plugins.application.plugin import ApplicationActions
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\application\__init__.py", line 14, in
from spyder.plugins.application.plugin import Application
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\application\plugin.py", line 26, in
from spyder.plugins.application.container import (
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\plugins\application\container.py", line 37, in
from spyder.utils.environ import WinUserEnvDialog
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\environ.py", line 19, in
from spyder.widgets.collectionseditor import CollectionsEditor
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\widgets\collectionseditor.py", line 39, in
from spyder_kernels.utils.nsview import (
ImportError: cannot import name 'get_numpy_type_string' from 'spyder_kernels.utils.nsview' (C:\Users
\Administrator\AppData\Roaming\Python\Python38\site-packages\spyder_kernels\utils\nsview.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 214, in main
mainwindow.main(options, args)
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 2293, in main
mainwindow = create_window(app, splash, options, args)
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 2148, in create_window
if main.console is not None:
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 1159, in __getattr__
return self.get_plugin(self._INTERNAL_PLUGINS_MAPPING[attr])
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 168, in get_plugin
raise SpyderAPIError('Plugin "{}" not found!'.format(plugin_name))
spyder.api.exceptions.SpyderAPIError: Plugin "internal_console" not found!
然后執(zhí)行pip check
C:\Users\Administrator>pip check
tensorflow 2.4.1 requires h5py, which is not installed.
tensorboard 2.4.1 requires werkzeug, which is not installed.
scikit-learn 0.24.1 requires threadpoolctl, which is not installed.
lesscpy 0.14.0 requires ply, which is not installed.
keras 2.4.3 requires h5py, which is not installed.
jupyterthemes 0.20.0 requires matplotlib, which is not installed.
jupyter-contrib-nbextensions 0.5.1 requires lxml, which is not installed.
-pyder 3.3.6 has requirement spyder-kernels
nels 1.10.3.
tensorflow 2.4.1 has requirement numpy~=1.19.2, but you have numpy 1.20.2.
spyder 5.0.0 has requirement qdarkstyle==3.0.2, but you have qdarkstyle 2.8.1.
spyder 5.0.0 has requirement spyder-kernels
ernels 1.10.3.
flake8 3.9.0 has requirement pycodestyle
2.6.0.
flake8 3.9.0 has requirement pyflakes
.
autopep8 1.5.6 has requirement pycodestyle>=2.7.0, but you have pycodestyle 2.6.
0.
C:\Users\Administrator>
那我們的spyder不能啟動是不是因為qdarkstyle和spyder-kernels的版本不匹配導(dǎo)致的呢,
因為用conda update --all命令之后,spyder-kernels變成了1.10.3.
我們安裝一下符合要求的版本
pip install qdarkstyle==3.0.2 update --use-feature=2020-resolver -i https://pypi.douban.com/simple --user
pip install spyder-kernels==2.0.1 update --use-feature=2020-resolver -i https://pypi.douban.com/simple --user
ERROR: pip's dependency resolver does not currently take into account all the pa
ckages that are installed. This behaviour is the source of the following depende
ncy conflicts.
-pyder 3.3.6 requires spyder-kernels
0.1 which is incompatible.
spyder 5.0.0 requires qdarkstyle==3.0.2, but you have qdarkstyle 2.8.1 which is
incompatible.
Successfully installed spyder-kernels-2.0.1
然后pip check 然后就不會有qdarkstyle版本不對的提示了。
然后再執(zhí)行spyder
還是這個錯誤提示
(base) C:\Users\Administrator>spyder
No QCoreApplication instance found. Application patches not applied. You have to
call load_stylesheet function after instantiation of QApplication to take effec
t.
我們查看spyder對應(yīng)的內(nèi)核是什么還是出現(xiàn)上面的錯誤提示
(base) C:\Users\Administrator>spyder kernelspec list
No QCoreApplication instance found. Application patches not applied. You have to
call load_stylesheet function after instantiation of QApplication to take effec
t.
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "D:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 21
4, in main
mainwindow.main(options, args)
kernel_client.hb_channel.time_to_dead = 25.0
File "D:\ProgramData\Anaconda3\Scripts\jupyter_client\client.py", line 364, in
hb_channel
self._hb_channel = self.hb_channel_class(self.context, self.session, url)
File "D:\ProgramData\Anaconda3\lib\site-packages\qtconsole\util.py", line 64,
in __new__
QClass.__init__(inst)
TypeError: __init__() missing 1 required positional argument: 'context'
是不是說明spyder沒有內(nèi)核可用。jupyter 內(nèi)核用的是如下
(base) C:\Users\Administrator>jupyter kernelspec list
Available kernels:
python3 D:\ProgramData\Anaconda3\share\jupyter\kernels\python3
在anaconda prompt窗口中我們用pip命令,把spyder卸載,然后用conda命令進行安裝,沒有錯誤提示,
(base) C:\Users\Administrator>conda install spyder
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
但是輸入spyder和spyder3都沒有反應(yīng)
說 不是內(nèi)部或外部命令,也不是可運行的程序或批處理文件。
conda list顯示spyder版本是3.3.6 spyder-kernels版本是 1.10.3
pip list 看不到spyder ,而spyder-kernels版本是 2.0.1
conda install把spyder裝到哪里去了呢?找了半天沒有找到,那我們把conda install安裝的spyder用conda uninstall spder卸
載掉試試
結(jié)果發(fā)現(xiàn)卸載不了
(base) C:\Users\Administrator>conda uninstall spyder
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are missing from the target enviro
nment:
- spyder
我們換conda remove命令試試發(fā)現(xiàn)跟前面的提示一模一樣。
是不是就是因為以前的spyder沒有卸載成功才導(dǎo)致這樣的問題呢?如何把spyder徹底卸載呢
我們發(fā)現(xiàn)這個路徑下有一個spyder文件夾,我們把這個文件夾手動刪掉,然后再執(zhí)行conda list看里面還有沒有spyder
"D:\ProgramData\Anaconda3\Lib\site-packages\spyder"
結(jié)果conda list里面還是有spyder3.3.6
我們嘗試把spyder-kernels 1.10.3刪掉
conda uninstall spyder-kernels
我們看下執(zhí)行結(jié)果 結(jié)果conda list下面還是有spyder-kernels 1.10.3
pip list下面spyder-kernels 的版本也變成 1.10.3
"D:\ProgramData\Anaconda3\Lib\site-packages\spyder_kernels-1.10.3.dist-info"這個文件夾下面只剩下spyder_kernels-
1.10.3.dist-info,沒有2.0.1那個版本了。
我們再用conda 命令卸載spyder_kernels-1.10.3試試
(base) C:\Users\Administrator>conda uninstall spyder_kernels
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are missing from the target enviro
nment:
- spyder_kernels
我們再用pip 命令卸載spyder_kernels-1.10.3試試,結(jié)果提示卸載成功。
我們再用conda list命令看下spyder_kernels庫是否還存在,發(fā)現(xiàn)spyder_kernels已經(jīng)不存在了
我們再用pip list命令看下spyder_kernels庫是否還存在,發(fā)現(xiàn)spyder_kernels也已經(jīng)不存在了
現(xiàn)在的問題就是cond list下面顯示有spyder庫,但是又不知道這個庫,或者是一些碎片文件放到哪了,想用也用不了。
我們再anaconda prompt里面用pip uninstall spyder 提示這個庫不存在
我們再anaconda prompt里面用conda uninstall spyder 提示PackagesNotFoundError: The following packages are missing
from the target enviro
nment:
是不是因為在anaconda prompt里面不能執(zhí)行呢?我們新打開一個cmd窗口輸入conda uninstall spyder發(fā)現(xiàn)和在anaconda prompt
執(zhí)行是一樣提示
C:\Users\Administrator>conda uninstall spyder
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are missing from the target environment:
- spyder
我們把用戶路徑下的.spyder文件刪除,然后再看conda list還是有spyder
C:\Users\Administrator>conda update spyder 執(zhí)行這個命令想升級一下spyder,結(jié)果說spyder不存在,既然不存在那為什么在
condalist下面有呢?
我們重啟下電腦試一下:仍然不能識別spyder或者spyder3
這樣一直無窮無盡耽誤時間太多,還是決定把安裝的anaconda卸了重裝,反正我是這么干的,強迫癥患者,這樣干凈
用360將anaconda卸載了。卸載完成之后又手動把開始里面的快捷方式刪掉了,還把appdata里面的一些關(guān)于anaconda conda的文件全部刪掉了
卸載完成之后按照下面的鏈接安裝anaconda
http://www.3lll3.cn/discuss/post/details/5f2a8378922c1e31e648de0f
可以使用spyder了就只能這樣簡單粗暴的解決問題了。沒辦法。
然后我還是執(zhí)行下conda list 看看那個神奇的spyder3.3.6是否沒有了
spyder 4.0.1 py37_0 defaults
spyder-kernels 1.8.1 py37_0 defaults
果然現(xiàn)在spyder已經(jīng)變了,那個神奇的無法卸載無法刪除無法更新無法使用也找不的spyder3.3.6 終于消失了,松了一口氣
C:\Users\Administrator>conda
usage: conda-script.py [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packag
es.
Options:
positional arguments:
command
clean Remove unused packages and caches.
compare Compare packages between conda environments.
config Modify configuration values in .condarc. This is modeled
after the git config command. Writes to the user .condarc
file (C:\Users\Administrator\.condarc) by default.
create Create a new conda environment from a list of specified
packages.
help Displays a list of available conda commands and their help
strings.
info Display information about current conda install.
init Initialize conda for shell interaction. [Experimental]
install Installs a list of packages into a specified conda
environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove.
run Run an executable in a conda environment. [Experimental]
search Search for packages and display associated information. The
input is a MatchSpec, a query language for conda packages.
See examples below.
update Updates conda packages to the latest compatible version.
upgrade Alias for conda update.
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages:
build
convert
debug
develop
env
index
inspect
metapackage
render
server
skeleton
verify
C:\Users\Administrator>
.condarc刪了怎么找回?
今天愛分享給大家?guī)韈ondarc文件找不到的問題【解決辦法】,希望能夠幫助到大家。
在創(chuàng)建conda環(huán)境的時候,需要修改
condarc文件的內(nèi)容。一開始怎么也找不到.condarc文件,系統(tǒng)提示也是無法找到該文件。通過查找資源,發(fā)現(xiàn)原來.condarc默認是
不會自動創(chuàng)建的,只有當用戶第一次使用conda config命令時,系統(tǒng)才會自動創(chuàng)建.condarc文件。(有一個專用詞,.condarc叫運行
期配置文件)
配置.
condarc文件
配置conda主要有兩種語法,
一種是添加,一種是設(shè)置
conda config --add [options] [parameters]
conda config --set [options] [yes|no]
添加通道(默認已經(jīng)包含defaults)
conda config --add channels defaults (會報錯顯示已經(jīng)含有defaults)
添加清華鏡像的國內(nèi)通道
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
添加環(huán)境目錄envs_dirs
conda config --add envs_dirs [path] (example: /anaconda/envs)
添加pkgs_dirs
conda config --add pkgs_dirs [path] (example: /anaconda/envs)
設(shè)置ssl_verify
conda config --set ssl_verify yes
設(shè)置show_channel_urls
conda config --set show_channel_urls yes
我們在cmd窗口第一次執(zhí)行conda config命令
結(jié)果在這個路徑下生成了"C:\Users\Administrator\.condarc"
用記事本打開這個文件,發(fā)現(xiàn)里面的內(nèi)容如下:
channels:
- defaults
ssl_verify: true
我們用conda config命令在里面添加一些國內(nèi)的鏡像源,比如在cmd命令窗口輸入(先把那個.condarc文件關(guān)閉再執(zhí)行)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
執(zhí)行完成沒有錯誤提示,我們在打開.condarc文件看下有沒有變化
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- defaults
ssl_verify: true
在channels那里除了原有的defaults,還增加了我們剛剛通過cmd窗口命令添加的那個channel。





