【发布时间】:2021-10-28 05:58:45
【问题描述】:
我在 mac m1 上使用 python 时遇到了困难,我发现pipenv 存在一个问题,无法使用正确的架构创建虚拟环境。如上图所示,当我用aram64架构打开终端,使用pipenv做虚拟环境时,架构变成了i386。我不确定这是否会导致大问题,它阻止了我使用一些 3rd 方包,例如 numpy 和 pandas,尽管我未能重现该错误。 (我记得,它显示了类似mach-o: but wrong architecture 的错误消息。)我使用的pipenv 的版本是2021.5.29。
> arch
arm64
> pipenv --python 3.8
Creating a virtualenv for this project...
Pipfile: /Users/seewoolee/development/tmp/Pipfile
Using /usr/bin/python3 (3.8.9) to create virtualenv...
⠦ Creating virtual environment...created virtual environment CPython3.8.9.final.0-64 in 388ms
creator CPython3macOsFramework(dest=/Users/seewoolee/.local/share/virtualenvs/tmp-miv_sugU, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/seewoolee/Library/Application Support/virtualenv)
added seed packages: pip==21.2.4, setuptools==58.1.0, wheel==0.37.0
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
✔ Successfully created virtual environment!
Virtualenv location: /Users/seewoolee/.local/share/virtualenvs/tmp-miv_sugU
Creating a Pipfile for this project...
> pipenv shell
Launching subshell in virtual environment...
. /Users/seewoolee/.local/share/virtualenvs/tmp-miv_sugU/bin/activate
> arch
i386
【问题讨论】:
-
pipenv 可执行文件本身的架构是什么?
file会告诉你吗?如果是英特尔,我相信 pipenv 将在 Rosetta 2 下运行,因此它看到的拱门是英特尔。它会尝试安装 intel pythons。如果您从 intel mac 迁移(例如),则可能会发生这种情况。或者如果您已经有一个 py 3.8 intel 版本并进行了迁移?
标签: python virtualenv apple-m1