- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
System:Win10
IDE: VSCode
Python path: C:\Users\user\AppData\Local\Continuum\miniconda3
在尝试通过 VSCode 终端安装 pandas 和 geopandas 以运行 Jupyter Notebook 时,我遇到了问题,所以我创建了一个 conda 环境并通过命令提示符安装了 pandas 和 geopandas,它们成功了。现在 Jupyter Notebook 工作了,我的 pythonfiles.py) 在 VSCode 上找不到 Pandas 。
> PS C:\Users\user\folder> python pythonfile.py
> Traceback (most recent call last): File
> "pythonfile.py", line 1, in <module>
> import pandas as pd ModuleNotFoundError: No module named 'pandas'
>
当我在 VSCode 中检查“pip list”时,结果:
Package Version
--------------- -------------------
asn1crypto 0.23.0
certifi 2017.11.5
cffi 1.11.2
chardet 3.0.4
conda 4.3.31
cryptography 2.1.4
idna 2.6
menuinst 1.4.10
numpy 1.19.5
pip 21.0.1
pycosat 0.6.3
pycparser 2.18
pyOpenSSL 17.5.0
PySocks 1.6.7
python-dateutil 2.8.1
pytz 2021.1
pywin32 221
requests 2.18.4
ruamel-yaml 0.11.14
setuptools 36.5.0.post20170921
six 1.11.0
urllib3 1.22
wheel 0.30.0
win-inet-pton 1.0.1
wincertstore 0.2
当我在命令提示符中检查 pip 列表时,结果
(env1) C:\Users\user>pip list
Package Version
---------------- -------------------
attrs 20.3.0
backcall 0.2.0
certifi 2020.12.5
chardet 4.0.0
click 7.1.2
click-plugins 1.1.1
cligj 0.7.1
colorama 0.4.4
cycler 0.10.0
decorator 4.4.2
Fiona 1.8.18
GDAL 3.2.2
geopandas 0.9.0
idna 2.10
ipykernel 5.5.0
ipython 7.18.1
ipython-genutils 0.2.0
jedi 0.17.2
jupyter-client 6.1.7
jupyter-core 4.6.3
kiwisolver 1.3.1
matplotlib 3.3.4
munch 2.5.0
numpy 1.20.1
pandas 1.2.3
parso 0.7.0
pickleshare 0.7.5
Pillow 8.1.2
pip 21.0.1
prompt-toolkit 3.0.8
Pygments 2.7.1
pyparsing 2.4.7
pyproj 3.0.1
python-dateutil 2.8.1
pytz 2021.1
pywin32 227
pyzmq 19.0.2
requests 2.25.1
setuptools 52.0.0.post20210125
Shapely 1.7.1
six 1.15.0
tornado 6.0.4
traitlets 5.0.5
urllib3 1.26.4
wcwidth 0.2.5
wheel 0.36.2
wincertstore 0.2
似乎环境中安装了 pandas 和 geopandas,但是,运行 pythoncode.py 仍然返回:
> Traceback (most recent call last): File
> "C:\Users\user\folder\pythonfile.py", line 1, in <module>
> import pandas as pd ModuleNotFoundError: No module named 'pandas'
>
当我返回 VSCode 并尝试再次安装 pandas 时,出现以下错误:
> PS C:\Users\user\folder> pip install pandas Collecting pandas
> Using cached pandas-1.1.5-cp36-cp36m-win_amd64.whl (8.7 MB)
> Requirement already satisfied: numpy>=1.15.4 in
> c:\users\user\appdata\local\continuum\miniconda3\lib\site-packages
> (from pandas) (1.19.5) Requirement already satisfied: pytz>=2017.2 in
> c:\users\user\appdata\local\continuum\miniconda3\lib\site-packages
> (from pandas) (2021.1) Requirement already satisfied:
> python-dateutil>=2.7.3 in
> c:\users\user\appdata\local\continuum\miniconda3\lib\site-packages
> (from pandas) (2.8.1) Requirement already satisfied: six>=1.5 in
> c:\users\user\appdata\local\continuum\miniconda3\lib\site-packages
> (from python-dateutil>=2.7.3->pandas) (1.11.0) ERROR: Could not
> install packages due to an OSError: [Errno 2] No such file or
> directory:'c:\\users\\user\\appdata\\local\\continuum\\miniconda3\\lib\\site-packages\\pytz-2021.1.dist-info\\METADATA'
如何让 pandas 和 geopandas 工作?
最佳答案
原因是VS Code内部终端使用的python和你当前在VS Code中选择的python环境不同(在VS Code左下角)。
我注意到您使用的是 powershell 终端,它在 VS Code 中默认不会自动激活 conda 环境。
F1
, Python: Select Interpreter
)Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
”,然后重新打开 VS Code 终端(Ctrl+Shift+`)。使用命令“python --version”时,它显示的python版本与左下角显示的相同。pip install pandas
)关于Python Pandas "Error: Could not install packages due to an OSError: No such file or directory:",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66891582/
我正在尝试在 Ubuntu 上运行 Python3,但遇到了一些奇怪的错误。该脚本显然无法找到我已确认存在的文件。 这是错误 Traceback (most recent call last):
我将大量文件写入一个文件夹,没有子目录,但是在写入 280 万个文件后,出现此错误: with open(bottleneck_path, 'w') as save_file: OSError: [E
我已经编写了自己的模块,主要处理 django 站点的文件字段。在弄乱了一些与 mod_wsgi 相关的东西之后(通过更新到 3.3 解决),我让我的代码运行。在所有必要的导入之后,在定义任何类或函数
我有以下代码: except(OSError) as (errno, strerror, filename): print "OSError [%d]: %s at %s" % (errno, str
由于某种原因,在使用 fromtimestamp 构造日期时间时,当我使用小于 -43200(-12 小时)的负数时,我得到一个“OSError [Errno22] Invalid Argument”
在声明 Theano 符号函数时,我得到一个 OSError 和回溯。有趣的是,相同的代码在不同的机器上运行。一台机器配置为使用 GPU,而另一台(有错误)仅配置为 CPU。有其他人经历过这种行为并知
我正在尝试创建一本新词典。 import os import datetime parent_dir = "E:\\" directory = "cali" now = datetime.dateti
我想像这样处理特定的 OSError 代码: try: os.scandir() except OSPermissionError as error: # Only catch er
我正在尝试在我的 Linux Ubuntu 64 位机器上安装 pycryptodomex 和 pycrypto。但是,我一直收到此错误:(提前致谢!) haomin@haomin-R110CS:~$
我有以下要测试的 python 代码: def find_or_make_logfolder(self): if not path.isdir(self.logfolder):
当我尝试将 OCRopus(基于 python 的 OCR 工具)应用于 TIFF 图像时,出现以下 python 错误: Traceback (most recent call last):
我在 Tensorflow 之上使用 Python 和 Keras 来训练我的神经网络。当我从 Ubuntu 16.04 切换到 Windows 10 时,运行以下命令时无法再保存我的模型: file
问题陈述 我正在使用 python3 并尝试 pickle 一个 IntervalTrees 字典,它的重量大约为 2 到 3 GB。这是我的控制台输出: 10:39:25 - project: IN
我一直在寻找一些对某些人来说可能相对愚蠢但对我来说非常有趣的东西! :-) 在 Python 3.3 中,输入和输出错误已与 OSError 合并,因此异常类层次结构发生了变化。内置类 OSError
如果我只是这样做: import lightgbm as lgb 我得到了 python script.py Traceback (most recent call last): File "scri
我有以下代码试图在 Linux 中启动下面的每个“命令”。如果两个命令中的任何一个因任何原因崩溃,该模块会尝试保持每个命令都运行。 #!/usr/bin/env python import subpr
我想执行以下简单的服务器代码: import socket s = socket.socket() # Create a socket object host = socket.get
我正在尝试在带有配置的 Power PC 上运行以下代码: Operating System: Red Hat Enterprise Linux Server 7.6 (Maipo) CPE OS N
当我尝试通过 django 管理界面上传媒体文件时,出现此错误: OSError: [Errno 45] Operation not supported 这是回溯的最后一行: File "/pat
使用 uwsgi 和 nginx 运行 Django 3 python 3.6 应用程序会抛出太多这些!我花了太多时间试图弄清楚,所以欢迎任何帮助。 它们绝对不是客户端断开连接。在网上查找时,我发现了
我是一名优秀的程序员,十分优秀!