繁体   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