无法从 virtualenv 运行 pip-分段错误(核心转储)

无法从 virtualenv 运行 pip-分段错误(核心转储)

我正在尝试使用 pip 在我的虚拟环境中安装各种需求,但无法解决错误Segementation fault (core dumped)。该错误似乎表示内存访问问题,但我不明白在 venv 中如何或为什么会发生这种情况。

soverton@osr-ubuntu-2:~/Documents/eroi-erp$ pipenv --python 3.7.2
Warning: Python 3.7.2 was not found on your system…
Would you like us to install CPython 3.7.2 with pyenv? [Y/n]: Y
Error: invalid input
Would you like us to install CPython 3.7.2 with pyenv? [Y/n]: Y
Installing CPython 3.7.2 with pyenv (this may take a few minutes)…
✔ Success! 
Downloading Python-3.7.2.tar.xz...
-> https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
Installing Python-3.7.2...
Installed Python-3.7.2 to /home/soverton/.pyenv/versions/3.7.2


Creating a virtualenv for this project…
Pipfile: /home/soverton/Pipfile
Using /home/soverton/.pyenv/versions/3.7.2/bin/python3.7m (3.7.2) to create virtualenv…
⠧ Creating virtual environment...Using base prefix '/home/soverton/.pyenv/versions/3.7.2'
Overwriting /home/soverton/.local/share/virtualenvs/soverton-mUoZmsRb/lib/python3.7/orig-prefix.txt with new content
New python executable in /home/soverton/.local/share/virtualenvs/soverton-mUoZmsRb/bin/python3.7m
Not overwriting existing python script /home/soverton/.local/share/virtualenvs/soverton-mUoZmsRb/bin/python (you must use /home/soverton/.local/share/virtualenvs/soverton-mUoZmsRb/bin/python3.7m)
Command /home/soverton/.loca...ZmsRb/bin/python3.7m -m pip config list had error code -11
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /home/soverton/.pyenv/versions/3.7.2/bin/python3.7m
✔ Successfully created virtual environment! 
Virtualenv location: /home/soverton/.local/share/virtualenvs/soverton-mUoZmsRb
Creating a Pipfile for this project…
soverton@osr-ubuntu-2:~/Documents/eroi-erp$ pipenv shell
Launching subshell in virtual environment…
 . /home/soverton/.local/share/virtualenvs/soverton-mUoZmsRb/bin/activate
soverton@osr-ubuntu-2:~$  . /home/soverton/.local/share/virtualenvs/soverton-mUoZmsRb/bin/activate
(soverton) soverton@osr-ubuntu-2:~/Documents/eroi-erp$ pip install django
Segmentation fault (core dumped)
(soverton) soverton@osr-ubuntu-2:~/Documents/eroi-erp$ pip
Segmentation fault (core dumped)
(soverton) soverton@osr-ubuntu-2:~/Documents/eroi-erp$ pip3
Segmentation fault (core dumped)

答案1

我通过首先使用 Python 3.6 创建环境来解决这个问题:pipenv --python 3.6。在这个环境中,和都可以正常pip工作pip3。然后我退出这个环境,删除Pipfile和,Pipfile.lock然后pipenv --python 3.7.2在同一目录中使用创建另一个环境,并且和pip再次pip3正常工作。

我猜这一定是 Python 3.7.2 的问题?

编辑:

正如 Shaun 在下面提到的那样,它可能与anaconda与 vanilla Python 一起安装并删除anaconda修复有关。

答案2

首先找出pip的位置。

跑步which pip

输出将指向一个文件。只需用扩展名重命名文件.py 即可

相关内容