安装numpy库 python 3.8
时间: 2023-09-13 12:13:09 浏览: 58
根据引用\[1\]和引用\[2\]的内容,你在Ubuntu 20.04上安装了Python 3.7.9,并且在使用PySpark时使用了Python 3.7。然而,在安装numpy等包时,直接使用pip install命令安装的是Python 3.8对应的版本和位置。所以在Python 3.8中可以import numpy,但在Python 3.7中不能。
为了解决这个问题,你可以按照引用\[2\]中的步骤,在"/usr/bin"目录下创建一个软链接,将pip3.7链接到你的Python 3.7的安装位置。具体命令如下:
sudo ln -s /usr/local/python3.7.9/bin/pip3.7 /usr/bin/pip3.7
然后,你可以使用pip3.7命令来安装需要的包,比如numpy。例如,你可以运行以下命令来安装numpy:
pip3.7 install numpy
如果你在安装numpy时遇到了"ERROR: Could not find a version that satisfies the requirement numpy"的错误,你可以按照引用\[3\]的建议,添加一个国内的镜像源来解决。你可以运行以下命令来安装numpy,并指定使用豆瓣的镜像源:
sudo pip3.7 install numpy -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
这样,你就可以在Python 3.8中使用numpy库了。
#### 引用[.reference_title]
- *1* *2* *3* [Ubuntu安装了python3.8和python3.7,安装numpy时出现问题](https://blog.csdn.net/weixin_44622140/article/details/116456241)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]