所以,我试图通过pip安装Crypto软件包,但出现此消息错误:
WARNING: The scripts crypto.exe and decrypto.exe are installed in 'C:\Users\MichałBogusz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
所以我将路径添加到PATH变量中,这就是现在在窗口中的样子:
即使在此之后,我仍然无法在我的Python项目中使用此模块。我该如何工作?
答案 0 :(得分:2)
就安装软件包而言,您可能只需要重新启动控制台并重试即可。有时PATH变量不会为打开的控制台刷新。
如果您想知道当前控制台的PATH上的内容,可以运行以下命令
echo %PATH%
检查您的当前路径。
如果您的软件包已经安装并且想要检查以确保已安装,则可以运行此命令以检查它是否已安装并打印出其安装位置:
import YOUR_MODULE
print(YOUR_MODULE.__file__)
答案 1 :(得分:1)
更改路径后,最好重新启动PC(或至少注销并登录),以确保已考虑路径。
如果仍然无法使用:
打开然后打开一个cmd.exe窗口 然后输入
echo %PATH%
where crypto
dir C:\Users\MichałBogusz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts
并将输出发送给我们
答案 2 :(得分:0)
C:\Users\MichałBogusz>echo %PATH%
C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\MATLAB\R2019b\bin;C:\Users\MichałBogusz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts;C:\Users\MichałBogusz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts
C:\Users\MichałBogusz>where crypto
INFO: Could not find files for the given pattern(s).
C:\Users\MichałBogusz>dir C:\Users\MichałBogusz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts
Volume in drive C has no label.
Volume Serial Number is DA0C-C2E7
Directory of C:\Users\MichałBogusz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts
10.10.2019 19:55 <DIR> .
10.10.2019 19:55 <DIR> ..
10.10.2019 12:50 103 361 chardetect.exe
07.10.2019 19:36 103 353 jsonschema.exe
07.10.2019 19:36 103 363 jupyter-kernel.exe
07.10.2019 19:36 103 401 jupyter-kernelspec.exe
07.10.2019 19:36 103 359 jupyter-migrate.exe
07.10.2019 19:38 103 361 jupyter-nbconvert.exe
07.10.2019 19:36 103 380 jupyter-run.exe
07.10.2019 19:36 103 364 jupyter-troubleshoot.exe
07.10.2019 19:36 103 392 jupyter-trust.exe
07.10.2019 19:36 103 359 jupyter.exe
10.10.2019 12:50 103 348 naked.exe
07.10.2019 19:37 103 355 pygmentize.exe
07.10.2019 19:36 24 815 pywin32_postinstall.py
07.10.2019 19:36 3 335 pywin32_testall.py
07.10.2019 19:36 <DIR> __pycache__
14 File(s) 1 268 546 bytes
3 Dir(s) 324 672 733 184 bytes free
这就是我得到的