我已将“ lxml-4.4.2-cp38-cp38-win_amd64.whl”下载到我的虚拟环境的“ site-packages”文件夹中。
如下所示,我已在全局环境中成功安装了'lxml'。
PS C:\Users\MY\desktop\reptile\venv\Lib\site-packages> pip install lxml-4.4.2-cp38-cp38-win_amd64.whl
Processing c:\users\my\desktop\reptile\venv\lib\site-packages\lxml-4.4.2-cp38-cp38-win_amd64.whl
Installing collected packages: lxml
Successfully installed lxml-4.4.2
但是我在虚拟环境中失败了。
(venv) PS C:\Users\MY\desktop\reptile\venv\Lib\site-packages> pip install lxml-4.4.2-cp38-cp38-win_amd64.whl
lxml-4.4.2-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
为了确保平台正确,我做了如下操作:
(venv) PS C:\Users\MY\desktop\reptile\venv\Lib\site-packages> python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
我真的不知道为什么。(这是我在stackOverflow中的第一个问题,我的英语不好。希望您能理解我的意思)
当计算机上安装了pycharm和python不兼容的组合(例如32位python设置和64位venv或64位python和32位venv时,会发生这种情况。由于您可以将64位软件包作为全局软件包安装,因此您拥有一个64位python,看起来您可能是在安装python 64位之前创建了venv或从其他计算机复制而来,因此在您的计算机上安装了32位venv电脑。删除venv并使用
生成新的c:> c:\ Python35 \ python -m venv c:\ path \ to \ myenv
它应该工作。
您必须在python中创建自己的虚拟环境,然后执行与代码使用相同的命令
How we create virtual env:
py -m pip install --user virtualenv
现在执行命令
How we create and install using virtual env