[英]Can't find jedi-language-server in command line in mac but can in Linux
I install jedi-language-server as the README.md.我将jedi-language-server安装为 README.md。 but I can't find
jedi-language-server --help
in My Mac(13 Ventura) system.但我在 My Mac(13 Ventura) 系统中找不到
jedi-language-server --help
。 But I can find this package in the pip list
.但是我可以在
pip list
中找到这个 package。
➜ ~ pip3 list | grep jedi
jedi 0.18.2
jedi-language-server 0.40.0
This is my new machine, not use conda
or other venv
moudle.这是我的新机器,没有使用
conda
或其他venv
模块。
➜ ~ echo $PATH
/Users/vzgoll/bin:/usr/local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
➜ ~ which jedi-language-server
jedi-language-server not found
➜ ~ python3 -m site
sys.path = [
'/Users/vzgoll',
'/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python39.zip',
'/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9',
'/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/lib-dynload',
'/Users/vzgoll/Library/Python/3.9/lib/python/site-packages',
'/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages',
]
USER_BASE: '/Users/vzgoll/Library/Python/3.9' (exists)
USER_SITE: '/Users/vzgoll/Library/Python/3.9/lib/python/site-packages' (exists)
ENABLE_USER_SITE: True
In order to verify, I install jedi-language-server in my Arch Linux, It can use command jedi-language-server --help
为了验证,我在我的 Arch Linux 中安装了jedi-language-server ,它可以使用命令
jedi-language-server --help
So I want to ask why this happened.所以我想问一下为什么会这样。
Add following code in my ~/.zshrc
.在我的
~/.zshrc
中添加以下代码。
pythonUserBaseDir=$(python3 -m site --user-base);
pythonUserBaseBinDir="$pythonUserBaseDir/bin"
export PATH="$pythonUserBaseBinDir:$PATH"
unset pythonUserBaseDir;
unset pythonUserBaseBinDir;
It's a $PATH
problem.这是一个
$PATH
问题。
You didn't reveal anything about your conda
or venv
config, and you didn't show us what $ echo $PATH
says.您没有透露有关您的
conda
或venv
配置的任何信息,也没有向我们展示$ echo $PATH
所说的内容。 You should have a python project environment for installing jedi and dependencies.你应该有一个 python 项目环境,用于安装 jedi 和依赖项。 When you activate the environment, the relevant
/bin
directory should be added to your $PATH
.当您激活环境时,相关的
/bin
目录应该添加到您的$PATH
中。 Apparently that only happened properly on your Linux install.显然,这只在您的 Linux 安装中正确发生。
Use $ which jedi-language-server
and $ ls -l
to debug the details, so your Mac config resembles the (working) Linux config.使用
$ which jedi-language-server
和$ ls -l
调试细节,因此您的 Mac 配置类似于(工作)Linux 配置。
Use $ python -m site
to examine the python library install directories.使用
$ python -m site
检查 python 库安装目录。 Notice how its output changes when you activate or deactivate the project environment.当您激活或停用项目环境时,请注意其 output 是如何变化的。
EDIT编辑
You're not using a project environment for python library installs?您没有为 python 库安装使用项目环境吗? I don't recommend that.
我不建议这样做。
There are very good reasons for using such an environment, which the current question is highlighting.使用这样的环境有很好的理由,当前问题正在强调这一点。
Perhaps you used sudo
when you pip installed it?也许你在安装 pip 时使用了
sudo
? Where did the install go? go 安装在哪里? Use
ls -l
or find
to locate it.使用
ls -l
或find
找到它。 Verify that you have permission to read the root-owned file.验证您是否有权读取 root 拥有的文件。 Verify that you have added its directory to your $PATH environment variable.
确认您已将其目录添加到 $PATH 环境变量中。
You have two OS environments, one of them working.您有两个操作系统环境,其中一个在工作。 Use the tools mentioned above to find how they differ, and to repair the faulty install.
使用上面提到的工具找出它们的不同之处,并修复错误的安装。
Focus on that /Users/vzgoll/Library/Python/3.9/lib/python/site-packages directory.关注 /Users/vzgoll/Library/Python/3.9/lib/python/site-packages 目录。 You should see several recently installed libraries in there, perhaps including jedi.
你应该在那里看到几个最近安装的库,可能包括 jedi。 Sometimes a library will include a
bin
directory under site-packages
.有时,库会在
site-packages
下包含一个bin
目录。 You should be able to run binaries by giving the full path, or more conveniently by appending the bin
directory to your $PATH
env var.您应该能够通过提供完整路径来运行二进制文件,或者通过将
bin
目录附加到您的$PATH
env var 来更方便。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.