两个Python实例,相同的库
目前我的 Linux 机器上运行着 Python 2.6 和 2.7。
现在,从 Python 2.7 开始,我无法访问通过 Python 2.6 包管理器安装的库。
我尝试卸载该库并将其重新安装,并将 Python 2.7 安装为默认运行时。运气不好。
如何在两个 Python 实例之间共享库?除了复制它们之外,还有更正确的方法吗?
如果有用:我的 Linux 发行版是 Debian,我的包管理器是 apt。
I currently have both Python 2.6 and 2.7 running on my Linux machine.
Now, from Python 2.7, I can't access the libraries that I installed through package manager for Python 2.6.
I tried uninstalling the library and installing it back with Python 2.7 installed as my default runtime. No luck.
How can I share libraries between two Python instances? Is there a more correct way to do this than just copying them?
If useful: my Linux distro is Debian, and my package manager is apt
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够将文件安装到外部位置并定义环境变量 PYTHONPATH 来指向包含模块的目录。
You should be able to install the files to an external location and define the environment variable
PYTHONPATH
to point to the directory that contains the modules.您现在应该有一个 /usr/lib/python2.6 文件夹和一个 /usr/lib/python2.7 文件夹。尝试在 2.7 文件夹内创建指向 2.6 文件夹内所需文件或文件夹的链接。
You should have now both a /usr/lib/python2.6 folder and a /usr/lib/python2.7. Try creating links inside the 2.7 folders to the required files or folders inside the 2.6 folder.