每当我尝试使用pip安装任何软件包时,我收到此导入错误:
guru@guru-notebook:~$ pip3 install numpy
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ImportError: cannot import name 'main'
Run Code Online (Sandbox Code Playgroud)
guru@guru-notebook:~$ cat `which pip3`
#!/usr/bin/python3
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
sys.exit(main())
Run Code Online (Sandbox Code Playgroud)
它之前工作正常,我不知道为什么它会抛出这个错误.我搜索了这个错误,但找不到任何解决方法.
如果您需要任何进一步的细节,请告诉我,我会更新我的问题.
我想知道是否可以在不离开IPython shell的情况下安装python包.
我们使用命令提示符c:\gcloud app deploy app.yaml,但出现以下错误:
Running "python3 -m pip install --requirement requirements.txt --upgrade --upgrade-strategy only-if-needed --no-warn-script-location --no-warn-conflicts --force-reinstall --no-compile (PIP_CACHE_DIR=/layers/google.python.pip/pipcache PIP_DISABLE_PIP_VERSION_CHECK=1)"
Step #2 - "build": /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Step #2 - "build": Done "python3 -m pip install --requirement requirements.txt --upgr..." (34.49892ms)
Step #2 - "build": Failure: (ID: 0ea8a540) /layers/google.python.pip/pip/bin/python3: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Step #2 - "build": …Run Code Online (Sandbox Code Playgroud) 我正在编写一些代码来报告和协调两个pip管理的python安装之间的差异.
如何在pip list不进行子程序调用pip的情况下以编程方式获取所提供的信息?
我的问题涉及这个问题:在代码中安装python模块,但涉及升级模块.
我试过了
packages=['apscheduler','beautifulsoup4','gdata']
def upgrade(packages):
for package in packages:
pip.main(['install --upgrade', package])
Run Code Online (Sandbox Code Playgroud)
和
def upgrade(packages):
for package in packages:
pip.main(['install', package + ' --upgrade'])
Run Code Online (Sandbox Code Playgroud)