"ModuleNotFoundError: No module named 'pycodestyle'"
"ModuleNotFoundError: No module named 'pycodestyle'"
我已经在我的 mac 上使用
在同一路径中安装了 pycodestyle
pip install pycodestyle
但是当我检查它的版本时,我得到-
"pycodestyle" --version
Traceback (most recent call last):
File "/Users/shashwatkhilar/tools/bin/pycodestyle", line 6, in <module>
from pycodestyle import _main
ModuleNotFoundError: No module named 'pycodestyle'
- 创建项目目录demo
- 将目录更改为项目目录
- 创建虚拟环境myenv
- 激活虚拟环境。
- 安装 pycodestyle
mkdir demo
cd demo
python3 -m venv myen
source myenv/bin/activate
pip install pycodestyle
使用这些命令中的任何一个检查它是否已安装
pip freeze
或
pycodestyle --version
因为您正在使用 mac。我认为你应该至少有两个版本的 python,而这个 pip 安装是与另一个 python 一起安装的。你可以试试
pip3 install pycodestyle
如果这不起作用,请尝试找到您要使用的正确版本并使用
设置别名
alias python=/usr/local/bin/python3
在 Mac 上,pip
指的是 Python 的旧版本。如果你想使用Python3,使用pip3
命令。
我已经在我的 mac 上使用
在同一路径中安装了 pycodestylepip install pycodestyle
但是当我检查它的版本时,我得到-
"pycodestyle" --version
Traceback (most recent call last):
File "/Users/shashwatkhilar/tools/bin/pycodestyle", line 6, in <module>
from pycodestyle import _main
ModuleNotFoundError: No module named 'pycodestyle'
- 创建项目目录demo
- 将目录更改为项目目录
- 创建虚拟环境myenv
- 激活虚拟环境。
- 安装 pycodestyle
mkdir demo
cd demo
python3 -m venv myen
source myenv/bin/activate
pip install pycodestyle
使用这些命令中的任何一个检查它是否已安装
pip freeze
或
pycodestyle --version
因为您正在使用 mac。我认为你应该至少有两个版本的 python,而这个 pip 安装是与另一个 python 一起安装的。你可以试试
pip3 install pycodestyle
如果这不起作用,请尝试找到您要使用的正确版本并使用
设置别名alias python=/usr/local/bin/python3
在 Mac 上,pip
指的是 Python 的旧版本。如果你想使用Python3,使用pip3
命令。