簡體   English   中英

安裝 colorama 時遇到問題

[英]Trouble installing colorama

C:\Users\*****>pip install colorama
Collecting colorama
  Using cached colorama-0.4.3-py2.py3-none-any.whl (15 kB)
Installing collected packages: colorama
Successfully installed colorama-0.4.3

C:\Users\*****>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import colorama
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'colorama'
>>> exit()

C:\Users\*****>pip uninstall colorama
Found existing installation: colorama 0.4.3
Uninstalling colorama-0.4.3:
  Would remove:
    c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama-0.4.3.dist-info\*
    c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama\*
Proceed (y/n)? y
  Successfully uninstalled colorama-0.4.3

C:\Users\*****>pip install "C:\Users\rober\Downloads\colorama-0.4.3-py2.py3-none-any.whl"
Processing c:\users\rober\downloads\colorama-0.4.3-py2.py3-none-any.whl
Installing collected packages: colorama
Successfully installed colorama-0.4.3

C:\Users\*****>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import colorama
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'colorama'

我不知道該怎么辦。 您可以看到我下載文件的位置,我正在運行最新的 pip 版本和 python 3.8。 在網上搜索后,我空手而歸。

我不知道您是否仍然需要幫助,但我遇到了同樣的問題並設法解決了它。

我剛進入 cmd 並輸入:

pip install colorama --user

它對我有用(編碼和 python 的新手,所以我有 3.8.3 並且在幾個 pip 安裝中遇到了類似的問題)。

從痕跡

啟動python運行64位python

C:\Users\*****>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

現在當你卸載時:

C:\Users\*****>pip uninstall colorama
Found existing installation: colorama 0.4.3
Uninstalling colorama-0.4.3:
  Would remove:
    c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama-0.4.3.dist-info\*
    c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama\*
Proceed (y/n)? y
  Successfully uninstalled colorama-0.4.3

它卸載到 32 位版本(注意-32后綴)。

所以pip可能指向 32 位版本。

使用 python 命令和-m選項來確保使用正確的安裝來安裝模塊會起作用:

python -m pip install colorama

您可以使用where pipwhere python ,這將確認它們指向不同的 python 包。

如果你不使用它,我建議你卸載 32 位版本的 python 以避免進一步混淆。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM