简体   繁体   English

如果设置了PythonPath,Anaconda和Spyder将无法打开

[英]Anaconda and Spyder won't open if PythonPath is set

I'm new to using Anaconda and Spyder and this must be a simple setting issue, but it's really frustrating. 我是刚开始使用Anaconda和Spyder的人,这肯定是一个简单的设置问题,但确实令人沮丧。 I need to have a PythonPath environment set because I frequently run scripts in ArcGIS which won't work without a path. 我需要设置PythonPath环境,因为我经常在ArcGIS中运行脚本,如果没有路径,这些脚本将无法运行。 However, neither Anaconda Navigator nor Spyder will not open if there is a PythonPath set. 但是,如果设置了PythonPath,Anaconda Navigator和Spyder都不会打开。 I get the splash screen, but that's it, it doesn't open. 我得到了启动屏幕,但仅此而已,它没有打开。 If I remove the PythonPath and reboot, Anaconda and Spyder work, but not ArcGIS. 如果删除PythonPath并重新启动,Anaconda和Spyder可以工作,但ArcGIS无法工作。 This is not an ArcGIS problem, rather Anaconda and Spyder just don't seem to like there being a PythonPath at all. 这不是ArcGIS问题,而是Anaconda和Spyder似乎根本不喜欢PythonPath。 Anyone have experience with this? 有人对此有经验吗?

For reference, my PythonPath contains: 作为参考,我的PythonPath包含:

C:\Python27;
C:\Python27\Lib;
C:\Python27\Lib\site-packages;
C:\Python27\DLLs;
C:\Python27\Lib\lib-tk;
C:\Python27\scripts;
C:\Python27\ArcGIS10.3\Lib;
C:\Python27\ArcGIS10.3\Lib\lib-tk;
C:\Python27\ArcGIS10.3\Lib\site-packages;
C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy;
C:\Program Files (x86)\ArcGIS\Desktop10.3\bin

I can remove everything except the bottom five and ArcGIS scripts still work, but it doesn't fix the problem with Spyder. 我可以删除除底部五个脚本之外的所有内容,并且ArcGIS脚本仍然可以使用,但不能解决Spyder的问题。 It probably has something to do with the files not actually being executables, but links to scripts. 它可能与实际上不是可执行文件而是指向脚本链接的文件有关。 For example, the shortcut for Spyder points to: 例如,Spyder的快捷方式指向:

C:\\ProgramData\\Anaconda2\\pythonw.exe C:\\ProgramData\\Anaconda2\\cwp.py C:\\ProgramData\\Anaconda2 "C:/ProgramData/Anaconda2/pythonw.exe" "C:/ProgramData/Anaconda2/Scripts/spyder-script.py" C:\\ ProgramData \\ Anaconda2 \\ pythonw.exe C:\\ ProgramData \\ Anaconda2 \\ cwp.py C:\\ ProgramData \\ Anaconda2“ C:/ProgramData/Anaconda2/pythonw.exe”“ C:/ ProgramData / Anaconda2 / Scripts / spyder- script.py”

which seems to leave a lot of room for trouble. 这似乎给麻烦留下了很大的空间。 Interestingly, if I run from the Command Prompt, the first time there are no errors but nothing happens, and the second time it displays: 有趣的是,如果我从命令提示符处运行,则第一次没有错误,但是什么也没有发生,而第二次显示:

Spyder is already running. Spyder已经在运行。 If you want to open a new instance, please pass to it the --new-instance option 如果要打开一个新实例,请将--new-instance选项传递给它

I don't know that I can directly offer a fix, but a nice workaround is spyder's PYTHONPATH manager inside the program. 我不知道我可以直接提供修复程序,但是一个不错的解决方法是程序中spyder的PYTHONPATH管理器。 If you open up spider you should be able to locate the pythonpath manager (on a mac it is under "python" tab) and manually add the necessary paths. 如果您打开Spider,您应该能够找到pythonpath管理器(在Mac上,它在“ python”标签下)并手动添加必要的路径。

You seem to have relic python installation kicking around and it wasn't uninstalled prior to installing ArcMap. 您似乎开始进行遗留的python安装,并且在安装ArcMap之前并未将其卸载。 The correct path structure for a clean installation of ArcMap with its associated python would consist of 干净安装ArcMap及其相关的python的正确路径结构包括

C:\\Python27\\ArcGISxx.x C:\\ Python27 \\ ArcGISxx.x

and there are no other files or folders in the C:\\Python27 path. 并且C:\\ Python27路径中没有其他文件或文件夹。 I would suggest uninstalling python completely and do a 'repair' of the arcmap distribution which will reinstall python and its dependencies correctly. 我建议完全卸载python并对arcmap发行版进行“修复”,这将正确地重新安装python及其依赖项。 In the interim, you should move the last 3 lines (which refer to arcmap) to the top of the dependency list. 在此期间,应将最后三行(指的是arcmap)移到依赖项列表的顶部。 That may resolve things temporarily. 那可能会暂时解决问题。

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

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