0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

マックのpython3でslugifyを既にインストールしているのに、スクリプトでimportしてもModuleNotFoundErrorが出てしまう件

Posted at

python-slugify 8.0.1awesome-slugify
unicode-slugifyと、それぞれ試してみましたが、どれもこれも「モジュール見つかりません」エラーがでて動かない。

from slugify import slugify
ModuleNotFoundError: No module named 'slugify'

モジュールのインストール自体は正常に行われているようだ。

% pip show unicode-slugify
Name: unicode-slugify
Version: 0.1.5
Summary: A slug generator that turns strings into unicode slugs.
Home-page: http://github.com/mozilla/unicode-slugify
Author: Jeff Balogh, Dave Dash
Author-email: jbalogh@mozilla.com, dd@mozilla.com
License: BSD
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: six, unidecode
Required-by: 

ダメ元でconda forgeからインストールしてみたら動いた

% conda install -c conda-forge python-slugify

Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: - 
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - conda-forge/osx-arm64::ipython==7.31.1=py38h10201cd_0
  - conda-forge/osx-arm64::scipy==1.7.3=py38hd0c9ec0_0
以下省略

頼んでないものまで延々とアプデされたりしたので驚いたけど、何かわからないけど凄く動いていて効き目がありそうな感触だけは凄い。1分くらいでインストールが無事終了。

from slugify import slugify
print(slugify('aads AAda asd as'))

出力結果:

aads-aada-asd-as

環境:

  • M1 Mac
  • Python 3.8.12
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?