python使用pip安装遇到的一些问题
程序员文章站
2023-12-27 09:26:51
...
系统提示没有pip或者pip找不到
如果python安装路径中没有pip的话,需要安装pip,这个网上教程很多的
如果有pip的话需要配置一下环境变量,这个也是常见的问题了。复制上图中的路径,右击电脑,属性,高级系统设置,环境变量,path,编辑,新建,将复制的路径添加到里面就行了。
在使用pip安装某些包的时候报错
F:\hlx>pip install numpy
Collecting numpy
Using cached https://files.pythonhosted.org/packages/bf/e8/15aea783ea72e2d4e51e3ec365e8dc4a1a32c9e5eb3a6d695b0d58e67cdd/numpy-1.19.2.zip
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'f:\python3.8\python.exe' 'f:\python3.8\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\hony\AppData\Local
\Temp\tmpz64v33w1'
cwd: C:\Users\hony\AppData\Local\Temp\pip-install-7uzk4grh\numpy
Complete output (200 lines):
Processing numpy/random\_bounded_integers.pxd.in
Processing numpy/random\bit_generator.pyx
Processing numpy/random\mtrand.pyx
Processing numpy/random\_bounded_integers.pyx.in
Processing numpy/random\_common.pyx
Processing numpy/random\_generator.pyx
Processing numpy/random\_mt19937.pyx
Processing numpy/random\_pcg64.pyx
Processing numpy/random\_philox.pyx
Processing numpy/random\_sfc64.pyx
Cythonizing sources
blas_opt_info:
blas_mkl_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in ['f:\\python3.8\\lib', 'C:\\', 'f:\\python3.8\\libs']
NOT AVAILABLE
这里有很长的错误报告,网上找了好久都没解决,报告末尾会有一段警告,只要按系统提示的升级一下pip版本就可以了。
WARNING: You are using pip version 19.2.1, however version 20.2.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
升级后再执行安装命令,如下:
F:\hlx>python -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl (1.5MB)
|████████████████████████████████| 1.5MB 233kB/s
Installing collected packages: pip
Found existing installation: pip 19.2.1
Uninstalling pip-19.2.1:
Successfully uninstalled pip-19.2.1
Successfully installed pip-20.2.4
如果还是不能的话,可以考虑网络问题,某些国外网络访问不到,可以换成国内源。加速pip安装python库的效率