Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ImportError:没有名为pip的模块_Python_Macos_Pip - Fatal编程技术网

Python ImportError:没有名为pip的模块

Python ImportError:没有名为pip的模块,python,macos,pip,Python,Macos,Pip,操作系统:Mac OS X 10.7.5 Python版本:2.7.5 我已经从安装了带有ez_setup.py的setuptools 1.0 然后我从下载pip.1.4.1pkg 在iTerm中运行(sudo)python setup.py安装 正在运行安装 运行bdist_egg运行egg_信息写入要求 pip.egg-info/requires.txt编写pip.egg-info/PKG-info编写 向pip.egg-info/top_level.txt写入依赖项链接的顶级名称 到pip

操作系统:Mac OS X 10.7.5 Python版本:2.7.5

我已经从安装了带有ez_setup.py的setuptools 1.0 然后我从下载pip.1.4.1pkg

在iTerm中运行(sudo)
python setup.py安装

正在运行安装
运行bdist_egg运行egg_信息写入要求
pip.egg-info/requires.txt编写pip.egg-info/PKG-info编写
向pip.egg-info/top_level.txt写入依赖项链接的顶级名称
到pip.egg-info/dependency_links.txt将入口点写入
pip.egg-info/entry\u points.txt警告:清单制造商:标准文件
找不到“setup.py”
正在读取清单文件'pip.egg info/SOURCES.txt'并写入清单文件
'pip.egg info/SOURCES.txt'将库代码安装到
build/bdist.macosx-10.6-intel/egg运行安装库警告:
install_lib:'build/lib'不存在--没有要安装的Python模块
安装
创建build/bdist.macosx-10.6-intel/egg creating
build/bdist.macosx-10.6-intel/egg/egg-INFO复制
pip.egg-info/PKG-info->build/bdist.macosx-10.6-intel/egg/egg-info
正在复制pip.egg-info/SOURCES.txt->
build/bdist.macosx-10.6-intel/egg/egg-INFO复制
pip.egg-info/dependency_links.txt->
build/bdist.macosx-10.6-intel/egg/egg-INFO复制
pip.egg-info/entry_points.txt->
build/bdist.macosx-10.6-intel/egg/egg-INFO复制
pip.egg-info/not-zip-safe->
build/bdist.macosx-10.6-intel/egg/egg-INFO复制
pip.egg-info/requires.txt->
build/bdist.macosx-10.6-intel/egg/egg-INFO复制
pip.egg-info/top_level.txt->
build/bdist.macosx-10.6-intel/egg/egg-INFO创建
“dist/pip-1.4.1-py2.7.egg”并添加
“build/bdist.macosx-10.6-intel/egg”将其删除
“build/bdist.macosx-10.6-intel/egg”(及其下的所有内容)
加工pip-1.4.1-py2.7.去蛋
“/Users/dl/Library/Python/2.7/lib/Python/site-packages/pip-1.4.1-py2.7.egg”
(和它下面的一切)创造
/Users/dl/Library/Python/2.7/lib/Python/site-packages/pip-1.4.1-py2.7.egg
将pip-1.4.1-py2.7.鸡蛋提取至
/Users/dl/Library/Python/2.7/lib/Python/site-packages PIP1.4.1是
已在easy-install.pth安装pip脚本中安装活动版本
将pip-2.7脚本安装到/Users/dl/Library/Python/2.7/bin
/Users/dl/Library/Python/2.7/bin
安装
/Users/dl/Library/Python/2.7/lib/Python/site-packages/pip-1.4.1-py2.7.egg
pip的处理依赖项==1.4.1已完成处理
pip的依赖项==1.4.1
然后我输入了
pip install
,错误消息如下所示

回溯(最近一次调用上次):文件
“/Library/Frameworks/Python.framework/Versions/2.7/bin/pip”,第9行,
在里面
加载第357行中的“build/bdist.macosx-10.6-intel/egg/pkg_resources.py”文件“build/bdist.macosx-10.6-intel/egg/pkg_resources.py”
加载\u条目\u点文件
“build/bdist.macosx-10.6-intel/egg/pkg_resources.py”,第2394行,中
加载\u条目\u点文件
“build/bdist.macosx-10.6-intel/egg/pkg_resources.py”,第2108行,中
加载导入错误:没有名为pip的模块

任何以前遇到过相同问题的人都可以给我一些解决方法吗?

我在尝试安装nova客户端时遇到了同样的问题

spencers-macbook-pro:python-novaclient root# python  setup.py install    
running install
/usr/bin/python: No module named pip
error: /usr/bin/python -m pip.__init__ install   'pbr>=0.5.21,<1.0' 'iso8601>=0.1.4' 'PrettyTable>=0.6,<0.8' 'requests>=1.1' 'simplejson>=2.0.9' 'six' 'Babel>=0.9.6' returned 1

如果使用macports,这些命令应该类似

我从下载了
pip
二进制文件,它解决了问题。

在终端中尝试以下操作:

ls -lA /usr/local/bin | grep pip
就我而言,我得到:

-rwxr-xr-x 1 root  root      284 Сен 13 16:20 pip
-rwxr-xr-x 1 root  root      204 Окт 27 16:37 pip2
-rwxr-xr-x 1 root  root      204 Окт 27 16:37 pip2.7
-rwxr-xr-x 1 root  root      292 Сен 13 16:20 pip-3.4
因此,在我的例子中,pip2 | | | pip2.7可以正常工作,而且在安装ez_安装程序后,应该有
easy_安装
可用。要安装
pip
只需执行以下操作:

easy_install pip

我认为上面这些答案都不能解决你的问题

我也曾经被这个问题弄糊涂过。您应该按照官方指南手动安装
pip
(目前包括运行)

之后,只需
sudopip安装Django
。 错误将消失。

我也有同样的问题。 我的解决方案:

对于Python 3

sudo apt-get install python3-pip
对于Python 2

sudo apt-get install python-pip

我知道这个线程很旧,但我只是在OSX上为自己解决了这个问题,与这里描述的不同

基本上,我通过brew重新安装了Python 2.7,它附带了pip。

如果尚未安装Xcode,请执行以下操作:

xcode-select –install
按说明安装Brew:

然后通过Brew安装Python:

brew install python
你完成了。就我而言,我只需要安装pyserial

pip install pyserial

在Mac上使用brew是一个更好的选择,因为apt get不可用。 命令:

如果计算机上同时安装了python2和python3

python2.7 -m ensurepip --default-pip
我们应该解决这个问题


如果python 3中缺少pip,只需在上面的命令中将
python2.7
更改为
python3

我通过将PYTHONPATH设置到站点包位置,解决了Linux上的类似错误。这是在运行
python get-pip.py--prefix/home/chet/pip
之后发生的

[chet@rhel1 ~]$ ~/pip/bin/pip -V
Traceback (most recent call last):
  File "/home/chet/pip/bin/pip", line 7, in <module>
    from pip import main
ImportError: No module named pip

[chet@rhel1 ~]$ export PYTHONPATH=/home/chet/pip/lib/python2.6/site-packages

[chet@rhel1 ~]$ ~/pip/bin/pip -V
pip 9.0.1 from /home/chet/pip/lib/python2.6/site-packages (python 2.6)
[chet@rhel1~]$~/pip/bin/pip-V
回溯(最近一次呼叫最后一次):
文件“/home/chet/pip/bin/pip”,第7行,在
从pip导入主
ImportError:没有名为pip的模块
[chet@rhel1~]$export PYTHONPATH=/home/chet/pip/lib/python2.6/site-packages
[chet@rhel1~]$~/pip/bin/pip-V
pip 9.0.1 from/home/chet/pip/lib/python2.6/site-packages(python 2.6)

尝试通过Python安装
pip

请浏览:

下载
获取pip.py
,然后运行:

(sudo) python get-pip.py

我的py版本是3.7.3,这个cmd有效

python3.7-mpip安装请求

请求库-用于从web API检索数据


这将运行pip模块,并要求它在PyPI.org(Python包索引)上找到请求库,并将其安装到您的本地系统中,以便您可以使用macOS 10.15和Homebrew 2.1.6导入它。我在使用Python 3.7时遇到此错误。我只需要跑:

python3 -m ensurepip
现在,
python3-mpip对我来说很有效。

在Linux上测试如下: 您可以直接从 卸载并直接与最新的python一起使用

tar -xvf  pip-0.2.tar.gz
cd pip-0.2
检查内容

anant$ ls
docs  pip.egg-info  pip-log.txt  pip.py  PKG-INFO  regen-docs  scripts  setup.cfg  setup.py  tests
直接执行:

anant$ python pip.py --help
Usage: pip.py COMMAND [OPTIONS]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -E DIR, --environment=DIR
                        virtualenv environment to run pip in (either give the
                        interpreter or the environment base directory)
  -v, --verbose         Give more output
  -q, --quiet           Give less output
  --log=FILENAME        Log file where a complete (maximum verbosity) record
                        will be kept
  --proxy=PROXY         Specify a proxy in the form
                        user:passwd@proxy.server:port. Note that the
                        user:password@ is optional and required only if you
                        are behind an authenticated proxy.  If you provide
                        user@proxy.server:port then you will be prompted for a
                        password.
  --timeout=SECONDS     Set the socket timeout (default 15 seconds)
这里有一个
tar -xvf  pip-0.2.tar.gz
cd pip-0.2
anant$ ls
docs  pip.egg-info  pip-log.txt  pip.py  PKG-INFO  regen-docs  scripts  setup.cfg  setup.py  tests
anant$ python pip.py --help
Usage: pip.py COMMAND [OPTIONS]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -E DIR, --environment=DIR
                        virtualenv environment to run pip in (either give the
                        interpreter or the environment base directory)
  -v, --verbose         Give more output
  -q, --quiet           Give less output
  --log=FILENAME        Log file where a complete (maximum verbosity) record
                        will be kept
  --proxy=PROXY         Specify a proxy in the form
                        user:passwd@proxy.server:port. Note that the
                        user:password@ is optional and required only if you
                        are behind an authenticated proxy.  If you provide
                        user@proxy.server:port then you will be prompted for a
                        password.
  --timeout=SECONDS     Set the socket timeout (default 15 seconds)
sudo port install py37-pip
sudo port select --set pip pip37
sudo port select --set pip3 pip37
sudo pip install numpy, scipy, matplotlib
ren python39._pth python39._pth.save
sudo apt-get update
sudo apt-get install python-pip (Python2)
sudo apt-get install python3-pip (Python3)
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
 File "/Users/marcelloromani/dev/<repository>/venv/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
$ deactivate
$ rm -rf venv
$ virtualenv venv
$ . venv/bin/activate
$ pip install -r src/requirements.txt
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
py get-pip.py
py -m pip install biopython
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
python get-pip.py
python -m pip --version
# For Python 2
sudo apt install python-pip

# For Python 3
sudo apt install python3-venv python3-pip
$python3 -m pip --version
/usr/bin/python3: No module named pip

$sudo apt-get install python3-pip
$python3 -m pip --version
$python3 -m pip install --upgrade pip