问题描述
今天,我通过
pip install pipenv
如文档中所述,我进入了一个测试目录并使用
As mentioned in the documentation I went to a test directory and created a new virtual environment using
pipenv shell
并尝试通过
pipenv 安装 numpy
我收到以下错误消息:
Installing numpy…
⠧
Error: An error occurred while installing numpy!
Traceback (most recent call last):
File "/Users/florian/.local/share/virtualenvs/test-bJfQ6Jzk/bin/pip", line 7, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'
即使在重新安装pipenv,删除所有文件并重新创建环境后也会出现此错误.如果我在环境内部或外部运行 pipenv install numpy
也没有影响.
This error occurs even after reinstalling pipenv, deleting all files and recreate the environment. It also had no impact if I ran pipenv install numpy
inside or outside the environment.
Python 3.6.3
Pipenv 11.10.1
Python 3.6.3
Pipenv 11.10.1
提前致谢.
推荐答案
尝试了一段时间后,我完全重新安装了 pip.这解决了问题,现在一切都按预期工作.
After trying around for a while, I fully reinstalled pip. This solved the problem and everything is working now as expected.
在提供解决问题的两个命令之前,我想说明一些事情:
Before providing the two commands, which solved the problem, I want to specify some things:
- 我使用的是 MacOS
- python 代表 python3(为此添加了别名,因为我只使用 python3)
- pip 是版本 9 而不是 10
这是两个命令:
sudo pip uninstall pip
sudo python get-pip.py
这篇关于Pipenv-Error: ModuleNotFoundError: 没有名为“pip._internal"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!