跨多个操作系统共享一个 PyCharm 项目(不同的解释器路径) [英] Share a PyCharm project across multiple operating systems (different interpreter paths)

查看:26
本文介绍了跨多个操作系统共享一个 PyCharm 项目(不同的解释器路径)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 PyCharm.我一半时间花在 Windows 机器上,另一半时间花在 Linux 上.我一直在使用 Dropbox 在两者之间同步我的项目(除了版本控制).这大部分工作正常,除了每次切换操作系统时,我都必须重置 PyCharm 项目解释器,因为两个操作系统的路径不同.

I have just gotten in to using PyCharm. I spend half my time on a Windows machine and the other half on Linux. I have been using Dropbox to sync my projects between the two (in addition to version control). This mostly works fine, except each time I switch operating systems, I have to reset the PyCharm project interpreter, because the paths for the two operating systems are different.

我唯一的选择是拥有两个不同的工作副本,每个操作系统一个(即停止将 Dropbox 用于 PyCharm 项目)吗?或者,有什么方法可以让 PyC​​harm 使用多个 Python 解释器并回退到一个可以工作的解释器上,这样我就可以将 Windows 和 Linux 配置存储在一个 PyCharm 项目文件中并让它自动工作?

Is my only option to have two different working copies, one for each operating system (i.e. stop using Dropbox for PyCharm projects)? Or, is there some way to get PyCharm to use multiple Python interpreters and fall-back on one that works, so that I can store both the Windows and the Linux configuration in a single PyCharm project file and have it work automatically?

推荐答案

使用设置| 中的编辑"按钮两台机器上的 Python 解释器将解释器重命名为不包含完整路径的名称(例如Python 2.7").项目文件存储解释器的名称,而不是路径,因此这将允许项目文件在两台机器上引用相同的解释器.

Use the "Edit" button in Settings | Python Interpreters on both machines to rename the interpreter to something that doesn't include the full path ("Python 2.7" for example). The project file stores the name of the interpreter, not the path, so this will allow the project file to reference the same interpreter on both machines.

这篇关于跨多个操作系统共享一个 PyCharm 项目(不同的解释器路径)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆