问题描述
我意识到我有一个过时的 numpy 版本:
I realized I had an outdated numpy version:
我试图更新它,但由于某种原因我无法在整台机器上安装:
I sought to update it, but I couldn't install on the entire machine for some reason:
好的,我将安装到 --user
然后:
Ok, I'll just install to --user
then:
但是版本没有更新!
安装的版本去哪了?
推荐答案
根据 Python 文档,这是使用用户方案"安装的:
As per the Python docs, this is installing using the "user scheme":
文件将安装到 site.USER_BASE 的子目录中(以下写为 userbase).
Files will be installed into subdirectories of site.USER_BASE (written as userbase hereafter).
您可以像这样看到您的 USER_BASE 值:
You can see your USER_BASE value like this:
我发现在我的机器上,这个 在 sys.path
上,但它位于全局安装目录之后.
I found that on my machine, this was on sys.path
, but it came after the global install directories.
我通过将它添加到我的 ~/.bash_profile
来解决它:
I solved it by adding this to my ~/.bash_profile
:
现在确实加载了最新版本:
Now the latest version is indeed loaded:
这篇关于如何访问由 `pip --user` 安装的软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!