python - 无法安装 pip 和软件包
问题描述
我正在使用python 3.6。Pip 与 python 一起安装。似乎 pip 没有出现。在这里尝试了各种可用的解决方案,但没有任何效果。请帮我解决这个问题。
验证完成:
路径设置C:\Program Files\Python36\Scripts
为所有 3 个添加的主机条目
画中画错误:
C:\Users\>pip
Traceback (most recent call last):
File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python36\Scripts\pip.exe\__main__.py", line 5, in <module>
ImportError: cannot import name 'main'
尝试过的解决方案:
pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org {package name}
C:\Users\>pip
Traceback (most recent call last):
File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python36\Scripts\pip.exe\__main__.py", line 5, in <module>
ImportError: cannot import name 'main'
C:\Users>python3 -m pip uninstall pip setuptools
'python3' is not recognized as an internal or external command,
operable program or batch file.
C:\Users>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python3 -m pip uninstall pip setuptools
File "<stdin>", line 1
python3 -m pip uninstall pip setuptools
^
SyntaxError: invalid syntax
>>> python3 -m pip uninstall pip setuptools
File "<stdin>", line 1
python3 -m pip uninstall pip setuptools
^
SyntaxError: invalid syntax
>>> pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org {package name}
File "<stdin>", line 1
pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org {package name}
^
SyntaxError: invalid syntax
>>>
使用以下版本
C:\Users\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
解决方案
在 Windows 10 上,我遇到了同样的问题。PIP 19
已经安装在我的系统中,但没有出现。错误是No Module Found
。
python -m pip uninstall pip
python -m pip install pip==9.0.3
降级pip
到 9.0.3 对我来说效果很好。
我已经在这里回答了
推荐阅读
- mysql - 在mysql galera集群中重置root密码
- react-native - 如何使用 nativebase 创建水平列表
- javascript - originalModel/object 即使在变量初始化之后也总是更新
- .htaccess - 使用 .htaccess 重写 URL(仅限域更改)
- reactjs - React Hooks 的提前返回问题
- swift - 你能在 Swift 的函数调用中增加一个变量吗?
- ios - SwiftUI 中的 didSet 有替代方案吗?
- python - 只读取 txt 文件 python 中的数字
- php - Laravel - 最多限制 2 个 API 调用
- spring-boot - 具有不同密码的同一 cassandra 集群中的密钥空间