Jupyter运行不同版本的已卸载库? [英] Jupyter running different version of uninstalled library?

查看:137
本文介绍了Jupyter运行不同版本的已卸载库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图修改一个现有的库,而不是聪明的方式,而是使用

So I was trying to modify an existing library and instead of doing it the smart way and using pip -e I instead just installed the libraries, then swapped the modified files for whatever changes I wanted. For example if I had:

Library A/ 
---doSomethingA.py 
---otherFiles.py

我刚刚删除了doSomethingA.py,然后将其替换为我的doSomethingA.py版本.从理论上讲,我认为,因为我是在本地编辑文件,所以它仍然可以按我的库计划进行工作,并具有我想要的任何其他功能.

I just deleted doSomethingA.py and replaced it with my version of doSomethingA.py. Theoretically I figured, because im editing the file locally, it should still work as planned for my library with whatever extra functionality I want.

但是....它基本上是疯了.虽然可以在文件中看到已编辑的更改,但是当我运行库时,它显然没有运行该文件.我做了类似的事情:

HOWEVER.... its basically going crazy. While I can see my edited changes in the file, when I run the library its obviously not running that file. I did things like:

  1. 注释掉整个文件(仍然以某种方式运行)

  1. commenting out the whole file (still runs somehow)

实际上使用doSomethingA.py卸载库和其他脚本的一部分仍可以运行?? (即import libraryA之类的东西在JupyerHub上起作用,但在putty终端上不起作用...?)

Actually uninstalling the library and part of another script using doSomethingA.py it still runs?? (i.e Something like import libraryA works on JupyerHub, but not on the putty terminal... ?)

我显然得出了这样的结论:它没有运行它所声明的文件(并且相信我,我已经检查了文件的路径大约10次).

I've obviously come to the conclusion that its not running the file that it says that it is (and trust me I've checked the path of the file like 10 times).

我的问题是:

  • 这怎么可能? python在哪里存储文件的另一个副本等?

我也删除了__pychache__,但是我想不起其他任何事情.我最好的选择是放弃并创建一个新的虚拟环境等吗?

I've also deleted the __pychache__, but I can't think of anything else to do. Is my best option to just give up and create a new virtual environment, etc?

推荐答案

我了解您正在jupyter hub上运行.

I understand that you are running on jupyter hub.

这意味着您的python正在服务器上远程运行,并且框架正在注意同步本地项目(但不同步已安装的库).

This means that your python is running remotly on the server and the framework is taking care to synch your local project (but not the installed libraries).

服务器上的python无法识别您的本地更改.

The python on the server is not aware of your local change.

作为临时缓解措施,您可以将已安装的库复制到项目根目录.

As a temporary mitigation you can copy the installed library to you project root.

这篇关于Jupyter运行不同版本的已卸载库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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