为什么pip安装程序对于某些模块不起作用?

时间:2019-11-27 19:20:30

标签: python numpy keras pip pycharm

我正在使用Python 3.8和Pip 3.8

我似乎无法使用pip安装某些模块。例如,当尝试安装keras模块时:

(venv) C:\Users\Spencer Pruitt\PycharmProjects\MNIST Analyzer>pip install keras
Collecting keras
  Using cached https://files.pythonhosted.org/packages/ad/fd/6bfe87920d7f4fd475acd28500a42482b6b84479832bdc0fe9e589a60ceb/Keras-2.3.1-py2.py3-none-any.whl
Collecting h5py (from keras)
  Using cached https://files.pythonhosted.org/packages/5f/97/a58afbcf40e8abecededd9512978b4e4915374e5b80049af082f49cebe9a/h5py-2.10.0.tar.gz
Collecting keras-preprocessing>=1.0.5 (from keras)
  Using cached https://files.pythonhosted.org/packages/28/6a/8c1f62c37212d9fc441a7e26736df51ce6f0e38455816445471f10da4f0a/Keras_Preprocessing-1.1.0-py2.py3-none-any.whl
Collecting numpy>=1.9.1 (from keras)
  Using cached https://files.pythonhosted.org/packages/ff/59/d3f6d46aa1fd220d020bdd61e76ca51f6548c6ad6d24ddb614f4037cf49d/numpy-1.17.4.zip
Collecting six>=1.9.0 (from keras)
  Using cached https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Collecting pyyaml (from keras)
  Using cached https://files.pythonhosted.org/packages/29/16/e4d675da1275a3aabd5e2a35e868273ba3f4859993acb55e77792f806315/PyYAML-5.1.2-cp38-cp38m-win32.whl
Collecting scipy>=0.14 (from keras)
  Using cached https://files.pythonhosted.org/packages/a7/5c/495190b8c7cc71977c3d3fafe788d99d43eeb4740ac56856095df6a23fbd/scipy-1.3.3.tar.gz
  Installing build dependencies ... error
  Complete output from command "C:\Users\Spencer Pruitt\PycharmProjects\MNIST Analyzer\venv\Scripts\python.exe" "C:\Users\Spencer Pruitt\PycharmProjects\MNIST Analyzer\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip" install --ignore-installed --no-user --prefix "C:\U
sers\Spencer Pruitt\AppData\Local\Temp\pip-build-env-qcebzlj8\overlay" --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel setuptools Cython>=0.29.13 "numpy==1.13.3; python_version=='3.5' and platform_system!='AIX'" "n
umpy==1.13.3; python_version=='3.6' and platform_system!='AIX'" "numpy==1.14.5; python_version=='3.7' and platform_system!='AIX'" "numpy==1.17.3; python_version>='3.8' and platform_system!='AIX'" "numpy==1.16.0; python_version=='3.5' and platform_system=='AIX'" "numpy
==1.16.0; python_version=='3.6' and platform_system=='AIX'" "numpy==1.16.0; python_version=='3.7' and platform_system=='AIX'" "numpy==1.17.3; python_version>='3.8' and platform_system=='AIX'":
  Ignoring numpy: markers 'python_version == "3.5" and platform_system != "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.7" and platform_system != "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.5" and platform_system == "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.6" and platform_system == "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.7" and platform_system == "AIX"' don't match your environment
  Ignoring numpy: markers 'python_version >= "3.8" and platform_system == "AIX"' don't match your environment
  Collecting wheel
    Using cached https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl
  Collecting setuptools
    Using cached https://files.pythonhosted.org/packages/9e/d5/444a443d890f09fc1ca1a2c3c9fc7e84cb148177b05ac94fe5084e3d9abb/setuptools-42.0.1-py2.py3-none-any.whl
  Collecting Cython>=0.29.13
    Using cached https://files.pythonhosted.org/packages/9c/9b/706dac7338c2860cd063a28cdbf5e9670995eaea408abbf2e88ba070d90d/Cython-0.29.14.tar.gz
  Collecting numpy==1.17.3
    Using cached https://files.pythonhosted.org/packages/b6/d6/be8f975f5322336f62371c9abeb936d592c98c047ad63035f1b38ae08efe/numpy-1.17.3.zip
  Installing collected packages: wheel, setuptools, Cython, numpy
    Running setup.py install for Cython: started
      Running setup.py install for Cython: finished with status 'done'
    Running setup.py install for numpy: started
      Running setup.py install for numpy: still running...
      Running setup.py install for numpy: finished with status 'done'
  Could not install packages due to an EnvironmentError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '"C:'


  ----------------------------------------
Command ""C:\Users\Spencer Pruitt\PycharmProjects\MNIST Analyzer\venv\Scripts\python.exe" "C:\Users\Spencer Pruitt\PycharmProjects\MNIST Analyzer\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip" install --ignore-installed --no-user --prefix "C:\Users\Spencer Pruitt\Ap
pData\Local\Temp\pip-build-env-qcebzlj8\overlay" --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel setuptools Cython>=0.29.13 "numpy==1.13.3; python_version=='3.5' and platform_system!='AIX'" "numpy==1.13.3; python_v
ersion=='3.6' and platform_system!='AIX'" "numpy==1.14.5; python_version=='3.7' and platform_system!='AIX'" "numpy==1.17.3; python_version>='3.8' and platform_system!='AIX'" "numpy==1.16.0; python_version=='3.5' and platform_system=='AIX'" "numpy==1.16.0; python_versi
on=='3.6' and platform_system=='AIX'" "numpy==1.16.0; python_version=='3.7' and platform_system=='AIX'" "numpy==1.17.3; python_version>='3.8' and platform_system=='AIX'"" failed with error code 1 in None

当我尝试安装numpy时,也会发生类似的问题。

(venv) C:\Users\Spencer Pruitt\PycharmProjects\MNIST Analyzer>pip install numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/ff/59/d3f6d46aa1fd220d020bdd61e76ca51f6548c6ad6d24ddb614f4037cf49d/numpy-1.17.4.zip
Installing collected packages: numpy
  Running setup.py install for numpy ... done
Could not install packages due to an EnvironmentError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '"C:'

预期的行为

安装过程将令人满意地完成,并且命令提示符将显示“ [模块名称]可以使用了!”。或类似的东西。

其他。 我是编程新手,不熟悉这里使用的术语。我完全是自学成才的,这是我第一次使用Python。衷心感谢有人给我介绍了如何正确安装这些模块,或者至少使您能正常工作。我一直在寻找其他问题,但是答案对我来说没有意义,或者这些问题似乎与我的问题不同。

谢谢!

2 个答案:

答案 0 :(得分:0)

请参阅this thread re:路径中的空格,导致安装numpy时出现问题。是否可以将虚拟环境/项目移至“ C:\ Temp \ MNIST_Analyzer”之类的位置?

This thread用于在路径中避开空格,适用于Mac,但可能与此有关。

答案 1 :(得分:0)

请使用python <3.7版进行numpy安装。或查看所需的python版本的模块/软件包。因此,只需升级和降级python版本即可使用软件包。