ModuleNotFoundError: No module named 'pandas' | `pip install pandas` & `poetry add pandas` fail
ModuleNotFoundError: No module named 'pandas' | `pip install pandas` & `poetry add pandas` fail
之前我已经能够 运行 并安装 pandas
库...
包括在 post 底部的 IDLE 回溯。
我开始相信我的设置存在更多潜在的严重问题。真的不知道是什么问题。
$ pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
航站楼:
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install --upgrade pip
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 722 kB/s
Installing collected packages: pip
Successfully installed pip-21.3.1
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install pandas
Requirement already satisfied: pandas in /home/me/.local/lib/python3.8/site-packages (1.3.4)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2.8.2)
Requirement already satisfied: numpy>=1.17.3; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/me/.local/lib/python3.8/site-packages (from pandas) (1.21.3)
Requirement already satisfied: pytz>=2017.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2021.3)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry add pandas
Using version ^1.3.4 for pandas
Updating dependencies
Resolving dependencies... (649.1s)
SolverProblemError
The current project's Python requirement (>=3.8,<4.0) is not compatible with some of the required packages Python requirement:
- tensorflow-io-gcs-filesystem requires Python >=3.6, <3.10, so it will not be satisfied for Python >=3.10,<4.0
- tensorflow-io-gcs-filesystem requires Python >=3.6, <3.10, so it will not be satisfied for Python >=3.10,<4.0
Because no versions of tensorflow match >2.5.0,<2.5.1 || >2.5.1,<2.5.2 || >2.5.2,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0
and tensorflow (2.5.1) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.5.2 || >2.5.2,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.5.2) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.6.0) depends on numpy (>=1.19.2,<1.20.0)
and tensorflow (2.6.1) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.6.2) depends on numpy (>=1.19.2,<1.20.0)
and tensorflow (2.5.0) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>=2.5.0,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
Because no versions of pandas match >1.3.4,<2.0.0
and pandas (1.3.4) depends on numpy (>=1.20.0), pandas (>=1.3.4,<2.0.0) requires numpy (>=1.20.0).
Thus, pandas (>=1.3.4,<2.0.0) is incompatible with tensorflow (>=2.5.0,<2.7.0 || >2.7.0,<3.0.0).
(1) So, because tensorflow (2.7.0) depends on tensorflow-io-gcs-filesystem (>=0.21.0), if pandas (>=1.3.4,<2.0.0) and tensorflow (>=2.5.0,<3.0.0) then tensorflow-io-gcs-filesystem (>=0.21.0).
Because no versions of tensorflow-io-gcs-filesystem match >0.21.0,<0.22.0 || >0.22.0
and tensorflow-io-gcs-filesystem (0.21.0) requires Python >=3.6, <3.10, tensorflow-io-gcs-filesystem is forbidden.
And because tensorflow-io-gcs-filesystem (0.22.0) requires Python >=3.6, <3.10, tensorflow-io-gcs-filesystem is forbidden.
And because if pandas (>=1.3.4,<2.0.0) and tensorflow (>=2.5.0,<3.0.0) then tensorflow-io-gcs-filesystem (>=0.21.0) (1), pandas (>=1.3.4,<2.0.0) is incompatible with tensorflow (>=2.5.0,<3.0.0)
So, because data-simulator depends on both tensorflow (^2.5.0) and pandas (^1.3.4), version solving failed.
at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
For tensorflow-io-gcs-filesystem, a possible solution would be to set the `python` property to ">=3.8,<3.10"
For tensorflow-io-gcs-filesystem, a possible solution would be to set the `python` property to ">=3.8,<3.10"
https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
https://python-poetry.org/docs/dependency-specification/#using-environment-markers
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
Traceback (most recent call last):
File "cli.py", line 5, in <module>
from alien import *
File "/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src/alien.py", line 3, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
建议的解决方案:
卸载,重新安装,运行又失败了。
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall pandas
Found existing installation: pandas 1.3.4
Uninstalling pandas-1.3.4:
Would remove:
/home/me/.local/lib/python3.8/site-packages/pandas-1.3.4.dist-info/*
/home/me/.local/lib/python3.8/site-packages/pandas/*
Proceed (y/n)? Y
Successfully uninstalled pandas-1.3.4
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install pandas
Collecting pandas
Using cached pandas-1.3.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
Requirement already satisfied: pytz>=2017.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2021.3)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2.8.2)
Requirement already satisfied: numpy>=1.17.3; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/me/.local/lib/python3.8/site-packages (from pandas) (1.21.3)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)
Installing collected packages: pandas
poetry run python3 cli.py
Successfully installed pandas-1.3.4
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
Traceback (most recent call last):
File "cli.py", line 5, in <module>
from alien import *
File "/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src/alien.py", line 3, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
闲置:
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> ls
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
ls
NameError: name 'ls' is not defined
>>> import pandas as pd
Warning (from warnings module):
File "C:\Users\me\Anaconda3\lib\site-packages\numpy\__init__.py", line 143
from . import _distributor_init
UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pandas as pd
File "C:\Users\me\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\Users\me\Anaconda3\pythonw.exe"
* The NumPy version is: "1.20.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
>>>
卸载 Numpy 成功,但 Setuptools 失败
danielbellhv@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall -y numpy
Found existing installation: numpy 1.21.3
Uninstalling numpy-1.21.3:
Successfully uninstalled numpy-1.21.3
danielbellhv@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall -y setuptools
Found existing installation: setuptools 45.2.0
Uninstalling setuptools-45.2.0:
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/shutil.py", line 791, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/__pycache__/easy_install.cpython-38.pyc' -> '/tmp/pip-uninstall-cmpyrogm/easy_install.cpython-38.pyc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
status = run_func(*args)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 97, in run
uninstall_pathset = req.uninstall(
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 671, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 384, in remove
moved.stash(path)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 282, in stash
renames(path, new_path)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 307, in renames
shutil.move(old, new)
File "/usr/lib/python3.8/shutil.py", line 812, in move
os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/__pycache__/easy_install.cpython-38.pyc'
更改文件 `` 的权限失败:
me@PF2DCSXD:/usr/lib/python3/dist-packages/__pycache__$ chmod 755 easy_install.cpython-38.pyc
chmod: changing permissions of 'easy_install.cpython-38.pyc': Operation not permitted
请告诉我还有什么可以尝试或添加到 post
尝试以下步骤...
卸载并重新安装pandas
pip uninstall pandas
知道
pip install pandas
or
pip3 install pandas
检查是否安装了[=s22=]
import pandas as pd
pd.__version__
问题识别:
我尝试了很多东西:pip install -y poetry
& pip install -y poetry-core
。
但是,我的系统中显然还残留着一些诗歌片段。
所以,每当我 运行 curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
,它永远不会给出完整的安装反馈。
这是因为:bin/lib/poetry/
仍然存在。
可能是由于尝试使用其他/非正式的 pip 命令进行卸载,而不是根据 documentation 推荐的方法。
If you see something like Poetry 0.12.0 then you are ready to use Poetry. If you decide Poetry isn’t your thing, you can completely remove it from your system by running the installer again with the --uninstall option or by setting the POETRY_UNINSTALL environment variable before executing the installer.
python get-poetry.py --uninstall
POETRY_UNINSTALL=1 python get-poetry.py
解法:
rm poetry/ -r
.
然后再次尝试安装:
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
Retrieving Poetry metadata
This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
$HOME/.poetry/bin
This path will then be added to your `PATH` environment variable by
modifying the profile file located at:
$HOME/.profile
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing version: 1.1.11
- Downloading poetry-1.1.11-linux.tar.gz (64.48MB)
Poetry (1.1.11) is installed now. Great!
To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.
To configure your current shell run `source $HOME/.poetry/env`
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ poetry install
bash: /home/me/.local/bin/poetry: No such file or directory
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ poetry run python3 cli.py
bash: /home/me/.local/bin/poetry: No such file or directory
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ source $HOME/.poetry/env
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ poetry install
Installing dependencies from lock file
Package operations: 82 installs, 0 updates, 0 removals
...
• Installing numpy (1.19.5)
...
• Installing pandas (1.3.1)
...
之前我已经能够 运行 并安装 pandas
库...
包括在 post 底部的 IDLE 回溯。
我开始相信我的设置存在更多潜在的严重问题。真的不知道是什么问题。
$ pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
航站楼:
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install --upgrade pip
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 722 kB/s
Installing collected packages: pip
Successfully installed pip-21.3.1
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install pandas
Requirement already satisfied: pandas in /home/me/.local/lib/python3.8/site-packages (1.3.4)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2.8.2)
Requirement already satisfied: numpy>=1.17.3; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/me/.local/lib/python3.8/site-packages (from pandas) (1.21.3)
Requirement already satisfied: pytz>=2017.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2021.3)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry add pandas
Using version ^1.3.4 for pandas
Updating dependencies
Resolving dependencies... (649.1s)
SolverProblemError
The current project's Python requirement (>=3.8,<4.0) is not compatible with some of the required packages Python requirement:
- tensorflow-io-gcs-filesystem requires Python >=3.6, <3.10, so it will not be satisfied for Python >=3.10,<4.0
- tensorflow-io-gcs-filesystem requires Python >=3.6, <3.10, so it will not be satisfied for Python >=3.10,<4.0
Because no versions of tensorflow match >2.5.0,<2.5.1 || >2.5.1,<2.5.2 || >2.5.2,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0
and tensorflow (2.5.1) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.5.2 || >2.5.2,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.5.2) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.6.0 || >2.6.0,<2.6.1 || >2.6.1,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.6.0) depends on numpy (>=1.19.2,<1.20.0)
and tensorflow (2.6.1) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>2.5.0,<2.6.2 || >2.6.2,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
And because tensorflow (2.6.2) depends on numpy (>=1.19.2,<1.20.0)
and tensorflow (2.5.0) depends on numpy (>=1.19.2,<1.20.0), tensorflow (>=2.5.0,<2.7.0 || >2.7.0,<3.0.0) requires numpy (>=1.19.2,<1.20.0).
Because no versions of pandas match >1.3.4,<2.0.0
and pandas (1.3.4) depends on numpy (>=1.20.0), pandas (>=1.3.4,<2.0.0) requires numpy (>=1.20.0).
Thus, pandas (>=1.3.4,<2.0.0) is incompatible with tensorflow (>=2.5.0,<2.7.0 || >2.7.0,<3.0.0).
(1) So, because tensorflow (2.7.0) depends on tensorflow-io-gcs-filesystem (>=0.21.0), if pandas (>=1.3.4,<2.0.0) and tensorflow (>=2.5.0,<3.0.0) then tensorflow-io-gcs-filesystem (>=0.21.0).
Because no versions of tensorflow-io-gcs-filesystem match >0.21.0,<0.22.0 || >0.22.0
and tensorflow-io-gcs-filesystem (0.21.0) requires Python >=3.6, <3.10, tensorflow-io-gcs-filesystem is forbidden.
And because tensorflow-io-gcs-filesystem (0.22.0) requires Python >=3.6, <3.10, tensorflow-io-gcs-filesystem is forbidden.
And because if pandas (>=1.3.4,<2.0.0) and tensorflow (>=2.5.0,<3.0.0) then tensorflow-io-gcs-filesystem (>=0.21.0) (1), pandas (>=1.3.4,<2.0.0) is incompatible with tensorflow (>=2.5.0,<3.0.0)
So, because data-simulator depends on both tensorflow (^2.5.0) and pandas (^1.3.4), version solving failed.
at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
• Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties
For tensorflow-io-gcs-filesystem, a possible solution would be to set the `python` property to ">=3.8,<3.10"
For tensorflow-io-gcs-filesystem, a possible solution would be to set the `python` property to ">=3.8,<3.10"
https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
https://python-poetry.org/docs/dependency-specification/#using-environment-markers
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
Traceback (most recent call last):
File "cli.py", line 5, in <module>
from alien import *
File "/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src/alien.py", line 3, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
建议的解决方案:
卸载,重新安装,运行又失败了。
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall pandas
Found existing installation: pandas 1.3.4
Uninstalling pandas-1.3.4:
Would remove:
/home/me/.local/lib/python3.8/site-packages/pandas-1.3.4.dist-info/*
/home/me/.local/lib/python3.8/site-packages/pandas/*
Proceed (y/n)? Y
Successfully uninstalled pandas-1.3.4
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ pip install pandas
Collecting pandas
Using cached pandas-1.3.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB)
Requirement already satisfied: pytz>=2017.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2021.3)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/me/.local/lib/python3.8/site-packages (from pandas) (2.8.2)
Requirement already satisfied: numpy>=1.17.3; platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10" in /home/me/.local/lib/python3.8/site-packages (from pandas) (1.21.3)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)
Installing collected packages: pandas
poetry run python3 cli.py
Successfully installed pandas-1.3.4
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src$ poetry run python3 cli.py
Traceback (most recent call last):
File "cli.py", line 5, in <module>
from alien import *
File "/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator/src/alien.py", line 3, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
闲置:
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> ls
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
ls
NameError: name 'ls' is not defined
>>> import pandas as pd
Warning (from warnings module):
File "C:\Users\me\Anaconda3\lib\site-packages\numpy\__init__.py", line 143
from . import _distributor_init
UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pandas as pd
File "C:\Users\me\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\Users\me\Anaconda3\pythonw.exe"
* The NumPy version is: "1.20.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
>>>
卸载 Numpy 成功,但 Setuptools 失败
danielbellhv@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall -y numpy
Found existing installation: numpy 1.21.3
Uninstalling numpy-1.21.3:
Successfully uninstalled numpy-1.21.3
danielbellhv@PF2DCSXD:/mnt/c/Users/dabell/Documents/GitHub/workers-python/workers/data_simulator/src$ pip uninstall -y setuptools
Found existing installation: setuptools 45.2.0
Uninstalling setuptools-45.2.0:
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/shutil.py", line 791, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/__pycache__/easy_install.cpython-38.pyc' -> '/tmp/pip-uninstall-cmpyrogm/easy_install.cpython-38.pyc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
status = run_func(*args)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 97, in run
uninstall_pathset = req.uninstall(
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 671, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 384, in remove
moved.stash(path)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 282, in stash
renames(path, new_path)
File "/home/danielbellhv/.local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 307, in renames
shutil.move(old, new)
File "/usr/lib/python3.8/shutil.py", line 812, in move
os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/__pycache__/easy_install.cpython-38.pyc'
更改文件 `` 的权限失败:
me@PF2DCSXD:/usr/lib/python3/dist-packages/__pycache__$ chmod 755 easy_install.cpython-38.pyc
chmod: changing permissions of 'easy_install.cpython-38.pyc': Operation not permitted
请告诉我还有什么可以尝试或添加到 post
尝试以下步骤...
卸载并重新安装pandas
pip uninstall pandas
知道
pip install pandas
or
pip3 install pandas
检查是否安装了[=s22=]
import pandas as pd
pd.__version__
问题识别:
我尝试了很多东西:pip install -y poetry
& pip install -y poetry-core
。
但是,我的系统中显然还残留着一些诗歌片段。
所以,每当我 运行 curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
,它永远不会给出完整的安装反馈。
这是因为:bin/lib/poetry/
仍然存在。
可能是由于尝试使用其他/非正式的 pip 命令进行卸载,而不是根据 documentation 推荐的方法。
If you see something like Poetry 0.12.0 then you are ready to use Poetry. If you decide Poetry isn’t your thing, you can completely remove it from your system by running the installer again with the --uninstall option or by setting the POETRY_UNINSTALL environment variable before executing the installer.
python get-poetry.py --uninstall
POETRY_UNINSTALL=1 python get-poetry.py
解法:
rm poetry/ -r
.
然后再次尝试安装:
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
Retrieving Poetry metadata
This installer is deprecated. Poetry versions installed using this script will not be able to use 'self update' command to upgrade to 1.2.0a1 or later.
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
$HOME/.poetry/bin
This path will then be added to your `PATH` environment variable by
modifying the profile file located at:
$HOME/.profile
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing version: 1.1.11
- Downloading poetry-1.1.11-linux.tar.gz (64.48MB)
Poetry (1.1.11) is installed now. Great!
To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.
To configure your current shell run `source $HOME/.poetry/env`
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ poetry install
bash: /home/me/.local/bin/poetry: No such file or directory
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ poetry run python3 cli.py
bash: /home/me/.local/bin/poetry: No such file or directory
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ source $HOME/.poetry/env
me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/workers-python/workers/data_simulator$ poetry install
Installing dependencies from lock file
Package operations: 82 installs, 0 updates, 0 removals
...
• Installing numpy (1.19.5)
...
• Installing pandas (1.3.1)
...