[英]Issue when pip installing packages
Please see my previous question here .请在这里查看我之前的问题。 I have spent all day searching on what my issues are and still running into pip install issues.我整天都在搜索我的问题是什么,但仍然遇到 pip 安装问题。 This time my error message is a little different.这次我的错误信息有点不同。 What I have done since my previous post:自上一篇文章以来我做了什么:
C:\mysys64\mingw64\bin
was added to my path under system environment variables确保C:\mysys64\mingw64\bin
已添加到系统环境变量下的路径中c_cpp_properties.json
specifically the "intelliSenseMode"
in VSCode from "windows-msvc-x64"
to "windows-gcc-x64"
编辑c_cpp_properties.json
特别是 VSCode 中的"intelliSenseMode"
,从"windows-msvc-x64"
到"windows-gcc-x64"
C:\msys64\mingw64\include\python3.9\Python.h
to make sure the errors were gone by the #include <unistd.h>
which they were.重新检查目录C:\msys64\mingw64\include\python3.9\Python.h
下的我的 Python.h 文件,以确保错误已被#include <unistd.h>
消除。pip install Flask-SQLAlchemy
and now I get the following errors...重试pip install Flask-SQLAlchemy
,现在我收到以下错误...Terminal window output终端 window output
Using cached Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl (17 kB)
Collecting SQLAlchemy>=0.8.0
Using cached SQLAlchemy-1.4.29.tar.gz (8.0 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: Flask>=0.10 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask-SQLAlchemy) (2.0.2)
Requirement already satisfied: itsdangerous>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.0.1)
Requirement already satisfied: Jinja2>=3.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (3.0.3)
Requirement already satisfied: click>=7.1.2 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (8.0.3)
Requirement already satisfied: Werkzeug>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.0.2)
Collecting greenlet!=0.4.17
Using cached greenlet-1.1.2.tar.gz (91 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: colorama in c:\msys64\mingw64\lib\python3.9\site-packages (from click>=7.1.2->Flask>=0.10->Flask-SQLAlchemy) (0.4.4)
Requirement already satisfied: MarkupSafe>=2.0 in c:\msys64\mingw64\lib\python3.9\site-packages (from Jinja2>=3.0->Flask>=0.10->Flask-SQLAlchemy) (2.0.1)
Building wheels for collected packages: SQLAlchemy, greenlet
Building wheel for SQLAlchemy (setup.py) ... done
Created wheel for SQLAlchemy: filename=SQLAlchemy-1.4.29-cp39-cp39-win_amd64.whl size=1512539 sha256=80ef3cf51b84f92e8117a57097054fcb25807ebf7755115d7df299bacf17a09d
Stored in directory: c:\users\t\appdata\local\pip\cache\wheels\6d\94\a6\8bdac6f92ce851f71a9fa62934a06cf2b654700b5f258242c7
Building wheel for greenlet (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\t\\AppData\\Local\\Temp\\pip-install-p182wkp5\\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\\setup.py'"'"'; __file__='"'"'C:\\Users\\t\\AppData\\Local\\Temp\\pip-install-p182wkp5\\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\t\AppData\Local\Temp\pip-wheel-iwgszyll'
cwd: C:\Users\t\AppData\Local\Temp\pip-install-p182wkp5\greenlet_78bb1f8ef93a452d8f0a86edfe24f6dd\
Complete output (69 lines):
Then some other errors like so然后像这样的其他一些错误
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\msys64\mingw64\include -IC:\msys64\mingw64\include\python3.9 "-IC:\Program
Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt" /Tcsrc/greenlet/greenlet.c /Fobuild\temp.win-amd64-3.9\Release\src/greenlet/greenlet.obj
greenlet.c
C:\msys64\mingw64\include\python3.9\Python.h(36): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for greenlet
Running setup.py clean for greenlet
Successfully built SQLAlchemy
Failed to build greenlet
Installing collected packages: greenlet, SQLAlchemy, Flask-SQLAlchemy
Running setup.py install for greenlet ... error
ERROR: Command errored out with exit status 1:
However there is no longer a squiggly error line under #include <unistd.h>
in my Python.h file.但是,在我的 Python.h 文件中, #include <unistd.h>
下不再有波浪线错误行。 Mind you I have no clue what I am doing in trying to fix this.请注意,我不知道我在尝试解决此问题时在做什么。 Please let me know if there is a solution.如果有解决方案,请告诉我。
Update 2022.02.01: I have unistalled version 3.9.7
of python and installed version 3.10.2
.更新 2022.02.01:我卸载了 python 的3.9.7
版并安装了3.10.2
版。 I have updated pip to version 22.02.2
and have tried the solutions given below.我已将 pip 更新到版本22.02.2
并尝试了下面给出的解决方案。 After downloading the wheels greenlet‑1.1.2‑cp310‑cp310‑win32.whl
and greenlet‑1.1.2‑cp310‑cp310‑win_amd64.whl
I went to my downloads folder and ran the commands and follows:下载 wheels greenlet‑1.1.2‑cp310‑cp310‑win32.whl
和greenlet‑1.1.2‑cp310‑cp310‑win_amd64.whl
后,我转到我的下载文件夹并运行以下命令:
C:\Users\t\Downloads>C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp310-cp310-win_amd64.whl
ERROR: greenlet-1.1.2-cp310-cp310-win_amd64.whl is not a supported wheel on this platform.
C:\Users\t\Downloads>C:\msys64\mingw64\bin\python.exe -m pip install greenlet-1.1.2-cp310-cp310-win32.whl
ERROR: greenlet-1.1.2-cp310-cp310-win32.whl is not a supported wheel on this platform.
After that didnt work I tried to pip install greenlet directly with pip install greenlet
and got the following output:之后没有工作我尝试 pip 直接pip install greenlet
并得到以下 output:
Building wheels for collected packages: greenlet
Building wheel for greenlet (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [69 lines of output]
and further down再往下
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for greenlet
Running setup.py clean for greenlet
Failed to build greenlet
Installing collected packages: greenlet
Running setup.py install for greenlet ... error
error: subprocess-exited-with-error
× Running setup.py install for greenlet did not run successfully.
│ exit code: 1
╰─> [71 lines of output]
and yet further down (hoping this may shine some light on the problem)再往下(希望这能对问题有所启发)
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.30.30705\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> greenlet
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Following commands solved the issue on my m1 Mac -以下命令解决了我的 m1 Mac 上的问题 -
- brew install graphviz
- python3 -m pip install \
--global-option=build_ext \
--global-option="-I$(brew --prefix graphviz)/include/" \
--global-option="-L$(brew --prefix graphviz)/lib/" \
pygraphviz
You can simply download an appropriate whl file from here and install it.您可以简单地从这里下载适当的 whl 文件并安装它。
For you greenlet‑1.1.2‑cp39‑cp39‑win_amd64.whl
should be correct.对你greenlet‑1.1.2‑cp39‑cp39‑win_amd64.whl
应该是正确的。 After downloading, cd
to your download directory and run下载后, cd
到你的下载目录并运行
C:\msys64\mingw64\bin\python.exe -m pip install greenlet‑1.1.2‑cp39‑cp39‑win_amd64.whl
Then try your original installation again.然后再次尝试您的原始安装。
Note笔记
There is also a whl file for Flask_SQLAlchemy‑2.5.1‑py3‑none‑any.whl
available on the same website.同一网站上还有一个Flask_SQLAlchemy‑2.5.1‑py3‑none‑any.whl
的 whl 文件。 You could also download and install that您也可以下载并安装它
The pip in the py -m pip
is different from the pip in the pip list
. py -m pip
中的 pip 不同于pip list
中的 pip。 You can through py -m pip --version
and pip --version
to get the pip locations.您可以通过py -m pip --version
和pip --version
获取 pip 位置。
I can install the greenlet package successfully through:我可以通过以下方式成功安装greenlet package:
pip install greenlet --no-cache-dir
I am using python310, It looks like have some problems with python39.我正在使用python310,看起来python39有一些问题。 If it does not work, as @FlyingTeller has suggested, you can download it manually.如果它不起作用,正如@FlyingTeller 建议的那样,您可以手动下载它。
As you described greenlet-1.1.2-cp39-cp39-win_amd64.whl
does not work, so have you tried greenlet‑1.1.2‑cp39‑cp39‑win32.whl
?正如您所描述greenlet-1.1.2-cp39-cp39-win_amd64.whl
不起作用,那么您是否尝试过greenlet‑1.1.2‑cp39‑cp39‑win32.whl
?
>>> import platform
>>> platform.architecture()
You can get architecture through the above codes.您可以通过上述代码获得架构。
I updated pip , setuptools and wheel and it it solved the problem.我更新了 pip 、 setuptools和wheel ,它解决了问题。
pip install --upgrade pip
pip install --upgrade setuptools wheel
note: if your pip is aliased as pip3 (Python 3) use pip3 instead of pip注意:如果您的 pip 别名为 pip3 (Python 3),请使用 pip3 而不是 pip
pip3 install --upgrade pip
pip3 install --upgrade setuptools wheel
refer to this link for more information: https://bobbyhadz.com/blog/python-error-legacy-install-failure有关详细信息,请参阅此链接: https://bobbyhadz.com/blog/python-error-legacy-install-failure
I had issues to install greenlet 2.0.1 in PyCharm on Mac M1.我在 Mac M1 上的 PyCharm 中安装 greenlet 2.0.1 时遇到问题。
I've upgraded:我升级了:
pip install --upgrade pip
pip install --upgrade setuptools wheel
And thanks to @joydeba comment - I've installed Homebrew:感谢@joydeba 的评论——我已经安装了 Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
*Follow the instructions at the end of installation *按照安装结束时的说明进行操作
After these steps I was able to install greenlet in PyCharm with no problem!完成这些步骤后,我可以毫无问题地在 PyCharm 中安装 greenlet!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.