[英]Python not recignizing module installed with pip
I'm trying to install the pybaseball package to practice learning python with some baseball data.我正在尝试安装 pybaseball package 来练习使用一些棒球数据学习 python。 I created a new python project with a python3.9 interpreter.
我使用 python3.9 解释器创建了一个新的 python 项目。 I then installed pybaseball with:
然后我安装了pybaseball:
C:\Users\sej16\AppData\Local\Programs\Python\Python39\python.exe -m pip install pybaseball
However, when I try to use the package (from pybaseball import statcast), I get a No module named 'pybaseball' error.但是,当我尝试使用 package(来自 pybaseball import statcast)时,我收到一个 No module named 'pybaseball' 错误。
Edit: the following code produced the output below.编辑:下面的代码产生了下面的 output。 Do I need to specify for pybaseball to be downloaded in the 'Scripts' directory?
我是否需要指定要在“脚本”目录中下载 pybaseball?
import os
import sys
print(os.path.dirname(sys.executable))
C:\Users\sej16\PycharmProjects\pythonProject4\venv\Scripts\python.exe C:/Users/sej16/PycharmProjects/pythonProject4/statcast.py C:\Users\sej16\PycharmProjects\pythonProject4\venv\Scripts\python.exe C:/Users/sej16/PycharmProjects/pythonProject4/statcast.py
C:\Users\sej16\PycharmProjects\pythonProject4\venv\Scripts C:\Users\sej16\PycharmProjects\pythonProject4\venv\Scripts
The comments were helpful and installing pybaseball to the python executable for pythonProject4 solves the issue and it is now recognized评论很有帮助,将 pybaseball 安装到 pythonProject4 的 python 可执行文件解决了这个问题,现在可以识别
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.