我以前以前遇到了环境不一致之后,在Conda环境中下载了 pip
的Tensorflow,经过几个小时的挫败感,决定删除Anaconda/Miniconda和Python和Python,从Scratch开始,将是我获得Python的最佳选择再次工作(这些不一致引起了很多加载其他模块等其他模块等问题的问题)。
在下载Python版本3.9.10之后,直接从,我想看看是否可以在VS代码的Jupyter笔记本中再次开始使用Python。当我尝试在python块中运行简单 print('Hello world')
(毫不奇怪)会收到以下错误:
jupyter无法启动。试图找到Jupyter的错误:使用“ Python 3.9.10 64位”运行单元格需要笔记本包。
运行以下命令将“ jupyter and Notebook”安装到Python环境中。
命令:'Python -M PIP安装jupyter笔记本-U'
我几乎期待这个错误,因为我知道在删除Anaconda和Python时删除了所有包裹。
但是,当我尝试运行 python -m pip install jupyter笔记本-U
中时,我最终会出现以下错误:
xcrun:错误:无效的活动开发人员路径(/library/developer/commandlinetools),在:/library/developer/commandlinetools/usr/usr/bin/xcrun中丢失xcrun
错误:命令'/usr/bin/gcc'出口代码1失败1
[输出的结尾]
注意:此错误源自子过程,并且可能不是PIP的问题。
错误:遗产安装 - 失败
×尝试安装软件包时遇到错误。
╰ - > psutil
注意:这是上面提到的软件包的问题,而不是pip。
非常感谢任何帮助或见识!如果这是有用的信息,我在MacOS(M1)上。
I was previously running into environment inconsistencies after downloading tensorflow with pip
in a conda environment, and after several hours of frustration, decided deleting anaconda/miniconda and python and starting from scratch would be my best option to get python working again (The inconsistencies were causing a plethora of issues with loading other modules like numpy, etc).
After downloading Python version 3.9.10 directly from https://www.python.org/downloads/macos/, I wanted to see if I could start using Python again in a Jupyter notebook in VS Code. When I try to run a simple print('hello world')
in a python chunk I (unsurprisingly) get the following error:
Jupyter cannot be started. Error attempting to locate jupyter: Running cells with 'Python 3.9.10 64-bit' requires notebook package.
Run the following command to install 'jupyter and notebook' into the Python environment.
Command: 'python -m pip install jupyter notebook -U'
I was pretty much expecting this error, since I knew I had deleted all packages when deleting Anaconda and Python.
However, when I try running python -m pip install jupyter notebook -U
in the terminal I ultimately get the following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> psutil
note: This is an issue with the package mentioned above, not pip.
Any help or insight is greatly appreciated! I am on MacOS (M1) if that is useful information.
发布评论
评论(4)
问题似乎是在MacOSX命令行工具随附的Python3分布中。好吧,在遵循这些步骤之后,至少存在同样的错误。
因此,为了解决问题,我安装了Python3.9(我认为您可以使用Homebrew将3.9更改为所需版本,例如3.8或3.10)。
brew-version
):用
来激活虚拟环境/激活
最后,使用
安装jupyter
The problem seems to be with the python3 distribution that comes with MacOSX Command Line Tools. Well, at least that same error was gone after following these steps.
So, to fix the problem I installed python3.9 (I presume you can change 3.9 to your desired version, e.g. 3.8 or 3.10) using Homebrew.
brew --version
in the terminal):Activate the virtual environment with
source myvenv/bin/activate
Finally, install Jupyter using
在MacOS 12.5 m2芯片上安装Jupyter笔记本时,我也有同样的问题。事实证明,该错误是由于我的Mac上没有GCC来运行车轮以安装PSUTIL软件包而引起的,因为由于某种原因,我从Mac中删除了Xcode。因此,我从AppStore安装了Xcode,并在安装后打开Xcode,以同意其条款和条件。 Xcode完成设置过程后,我再次尝试了
pip install jupyter
,并且效果很好。I have the same problem when installing the Jupyter notebook on MacOS 12.5 M2 chip. It turns out that the error is caused by not having GCC on my mac to run the wheel for installing the psutil package because for some reason I removed my XCode from my Mac. So I installed XCode from AppStore and opened XCode after the installation to agree to its terms and conditions. After Xcode went through the setup process I tried
pip install jupyter
again and it worked well.就我而言,我刚刚打开了Xcode,接受术语和提议的安装,并尝试再次安装jupyter并起作用!
In my case, I just opened the XCode, accept the terms and the installation proposed, and tried to install the jupyter again and it worked!
对于安装Python的版本,这似乎很特别。我今天早上在新盒子上设置了一个新的安装,并在那里放置3.11。
pip install jupyterlabs
给了我与您相同的错误。然后,我卸载了Python并安装了一个较早的版本,现在可以使用。PS对我有用的较旧版本是3.10.8
It seems to be very particular about the version of python installed. I set up a fresh installation on a new box this morning and put 3.11 on there.
pip install jupyterlabs
gave me the same error as you got. I then uninstalled python and installed an earlier version, and now it works.PS the older version that worked for me is 3.10.8