尝试以管理员身份运行以下命令:
或者
pip install numpy --user
以不需要特殊权限的方式安装numpy。
我曾经遇到过其他软件包的同样问题。只需尝试
pip install 'package name' --user
然后看看问题是否已解决。对我来说有效。
First, try to import numpy
and use it. If it doesn't work, try the second option.
Try to install numpy
again with user privilege by running the command below:
pip install numpy --user
这是一个权限问题。在我的情况下,当我尝试强制安装 tensorflow_gpu
时,出现了一个 wheel.exe
错误。我通过在命令末尾添加 --user
来避免这个错误。
pip3 install --upgrade --force-reinstall tensorflow-gpu --user
...
):PS > pip install -r pkgs.txt
Collecting black
Using cached black-22.3.0-cp310-cp310-win_amd64.whl (1.1 MB)
Collecting bs4
...
Installing collected packages: pycparser, cffi, attrs, ...
WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an OSError: [WinError 2] The system can
not find the file specified: 'C:\\Python310\\Scripts\\normalizer.exe' -> 'C:\\Py
thon310\\Scripts\\normalizer.exe.deleteme'
PS > gsudo pip install -r pkgs.txt
Collecting black
Using cached black-22.3.0-cp310-cp310-win_amd64.whl (1.1 MB)
Collecting bs4
...
Installing collected packages: certifi, websockets, ...
Running setup.py install for path-and-address ... done
Running setup.py install for docopt ... done
Running setup.py install for bs4 ... done
Successfully installed Flask-2.1.1 Markdown-3.3.6 Pillow-9.1.0 PuLP-2.6.0 ...
在安装某些包时,我遇到了完全相同的问题。要解决这个问题,我在pip install
之前添加了py -m
。
例如:
py -m pip install requests
或者在 Mac 电脑上
python3 -m pip install requests
在具有管理员权限的命令提示符中运行Python命令
注:要以管理员权限打开命令提示符,请执行以下步骤:
我在安装InstagramScrapper时遇到了一个错误,但我按照以下步骤解决了它:
pip3 install instagramscraper --user
对我来说它有效
查看C/python/Scripts目录属性,发现该文件夹标记为只读。更改此属性后,问题得到解决。
python
并import numpy
,它能用吗?或许有人已经为您安装了此程序包。如果没有,您可能需要使用管理员权限运行此命令。 - Tim Roberts