我正在使用 python 2.7.4,运行时遇到问题pip install random
。出现以下错误:
Collecting random
Could not find a version that satisfies the requirement random (from versions: )
No matching distribution found for random
有人能帮我解决这件事吗?
结果pip install -vvv random # verbose output
:
File "c:\users\support-ihsan\app\lib\site-packages\pip_internal\req\req_install.py", line 307, in populate_link self.link = finder.find_requirement(self, upgrade)
File "c:\users\support-ihsan\app\lib\site-packages\pip_internal\index.py", line 533, in find_requirement 'No matching distribution found for %s' % req DistributionNotFound: No matching distribution found for random
答案1
这意味着没有名为 random 的包。
随机模块也应该默认存在。因为此代码在装有 python2 的机器上运行良好
import random
num = random.randint(10,20)
print (num)
当我输入此命令时,我也遇到了同样的错误
pip install random