[英]Mac M1 python packages error after upgrade to python3
I am writing a project in NativeScript and I received the following error the last few days when I tried the commands: ns run ios
or ns doctor
.我正在 NativeScript 中编写一个项目,最近几天我尝试这些命令时收到以下错误:
ns run ios
或ns doctor
。
Couldn't retrieve installed python packages.无法检索已安装的 python 包。
The Python 'six' package not found. Python '六' package 未找到。
I tried python and pip upgrade and also the command pip install six
.我尝试了 python 和 pip 升级以及命令
pip install six
。 Nothing of them fixed the problem.他们都没有解决问题。
I believe that is not a NativeScript issue, is about the configuration of the python packages in my machine.我相信这不是 NativeScript 问题,而是关于我机器中 python 包的配置。 I mention that I am using a MacBook with M1 chip and it is running the 12.5 OS version.
我提到我使用的是带有 M1 芯片的 MacBook,它运行的是 12.5 操作系统版本。
I will appreciate any suggestions on this situation.对于这种情况的任何建议,我将不胜感激。
Lastly, I found the solution.最后,我找到了解决方案。 It was about the python folder into the path /usr/local/bin/python
就是把python这个文件夹放到路径/usr/local/bin/python
You could check it by the following command: where python
您可以通过以下命令查看它:
where python
In my case this folder is missing, perhaps I deleted it after the upgrade of the python3.在我的例子中,这个文件夹丢失了,也许我在升级 python3 后删除了它。
That was a mistake both folders should exist on this path!这是一个错误,两个文件夹都应该存在于这条路径上!
If you type: where python
you should receive: /usr/local/bin/python如果你输入:
where python
你应该收到:/usr/local/bin/python
If you type: where python3
you should receive: /usr/local/bin/python3如果你输入:
where python3
你应该收到:/usr/local/bin/python3
In order to fix the error, I installed python again by using the brew install pyenv
this suggestion helps me to install it properly.为了修复错误,我使用
brew install pyenv
这个建议帮助我正确安装它。
In the end, in order to eliminate all errors I installed the Python six package by using the command: pip install --ignore-installed six
最后,为了消除所有错误,我使用以下命令安装了 Python 6 package:
pip install --ignore-installed six
Try doing it with the python virtual environment.尝试使用 python 虚拟环境执行此操作。 Following are the steps.
以下是步骤。
Implement as follows:实现如下:
python3 -m venv venv
source venv/bin/activate
venv\Scripts\activate.bat
'venv\Scripts\Activate.ps1' 'venv\Scripts\Activate.ps1'
python3 -m pip install --upgrade pip
python3 -m pip install six
Note: This works only when you are in the virtual environment.注意:这仅在您处于虚拟环境中时有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.