常规的PyCharm,Anaconda和Jupyter用户,但是我第一次开始一个项目,这将有利于让他们一起玩:
我在PyCharm中运行了一个正确配置的Anaconda环境,但是当我尝试启动ipynb
笔记本(在PyCharm中jupyter notebook
完全正常工作时,我得到...
/home/bolster/anaconda3/bin/python3.5 /home/bolster/anaconda3/bin/jupyter-notebook --no-browser --ip 127.0.0.1 --port 8888
[W 12:33:12.515 NotebookApp] Unrecognized JSON config file version, assuming version 1
[W 12:33:12.519 NotebookApp] Config option `matplotlib` not recognized by `NotebookApp`.
[W 12:33:12.521 NotebookApp] Config option `matplotlib` not recognized by `NotebookApp`.
Traceback (most recent call last):
File "/home/bolster/anaconda3/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/home/bolster/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/bolster/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 595, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/bolster/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/bolster/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 1069, in initialize
self.init_configurables()
File "/home/bolster/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 837, in init_configurables
parent=self,
File "/home/bolster/anaconda3/lib/python3.5/site-packages/nb_conda_kernels/manager.py", line 19, in __init__
specs = self.find_kernel_specs() or {}
File "/home/bolster/anaconda3/lib/python3.5/site-packages/nb_conda_kernels/manager.py", line 129, in find_kernel_specs
self.conda_info = self._conda_info()
File "/home/bolster/anaconda3/lib/python3.5/site-packages/nb_conda_kernels/manager.py", line 29, in _conda_info
p = subprocess.check_output(["conda", "info", "--json"]
File "/home/bolster/anaconda3/lib/python3.5/subprocess.py", line 629, in check_output
**kwargs).stdout
File "/home/bolster/anaconda3/lib/python3.5/subprocess.py", line 696, in run
with Popen(*popenargs, **kwargs) as process:
File "/home/bolster/anaconda3/lib/python3.5/subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "/home/bolster/anaconda3/lib/python3.5/subprocess.py", line 1544, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'conda'
我有一种预感,这是因为PyCharm没有尝试在“真实”用户环境中启动笔记本,因此没有获得我的$ PATH导入(在.profile
中),但是这样做不是“运行配置”我看不到任何方式“指向”IDE查找conda
可执行文件的正确路径。
然而如果我将一个conda可执行文件的链接添加到/usr/bin/
,它可以工作,但这是一个关于协作项目的hackery顺序,我并不满意。
有没有办法强制PyCharm查看正确的位置或至少更新内部全局环境变量,以避免认真告诉他们需要从用户空间环境链接到根箱的协作者?
答案 0 :(得分:2)
从终端启动的任何应用程序都将继承终端的所有属性。如果以非终端方式启动PyCharm,那么.profile中定义的$ PATH将不会被继承,因此默认为$ PATH。
从shell启动PyCharm然后继承.profile中的$ PATH。现在,PyCharm能够在路径中找到conda。
另一种方法是使用PATH变量在/etc/profile.d folder中创建.sh文件。这些变量是系统范围的。所以,现在没有必要从终端启动PyCharm。
此类行为和备用解决方案的原因在this StackOverflow帖子中指定。
希望这有帮助!
答案 1 :(得分:-1)
看起来问题类似于此处描述的问题:https://youtrack.jetbrains.com/issue/PY-17739请投票!指定的开发人员已在调查原因。