英文:
How do I change the directory where pip installs packages?
问题
I have a problem where pip installs packages in the wrong directory: C:\Users\mikke\AppData\Roaming\python\python311\sitepackages
, but my python is installed in C:\Program Files\Python311
. I'm pretty new to python and use pycharm as my IDE, the problem I have is that pycharm doesn't recognize any of the packages I install, and I'm pretty sure it's because they are installed in the wrong directory.
First I tried to go on the internet to find answers on how to do this, but I couldn't find anything. Then I tried to go into my system variables and found out I had two different variables for python scripts, and one of the variables had the path: C:\Users\mikke\AppData\Roaming\python\python311\scripts
, so I deleted the one with the path I didn't want my packages to go to, but it didn't work. Then I tried to uninstall pip, with the command: python -m pip uninstall pip
, it deleted the pip exe's in the scripts folder, but when I tried to install the packages again it still installed in the wrong directory.
英文:
I have a ploblem where pip installs packages in the wrong directory: C:\Users\mikke\AppData\Roaming\python\python311\sitepackages
, but my python is installed in C:\Program Files\Python311
. I'm pretty new to python and use pycharm as my IDE, the problem i have is that pycharm doesn't recognize any of the packages I install and I'm pretty sure it's because they are installed in the wrong directory.
First I tried to go on the internet to find answers on how to do this, but I couldn't find anthing. Then I tried to go into my system variables and found out I had two different varibles to python script and one of the variables had the path: C:\Users\mikke\AppData\Roaming\python\python311\scripts
, so i deleted the one with the path i didn't want my packages to go to, but it didn't work.
Then I tried to uninstall pip, with the command: python -m pip uninstall pip
, it deleted the pip exe's in the scipts folder, but when i tried to install the packages again it still installed to the wrong directory.
答案1
得分: 1
PyCharm通常使用一种虚拟环境的选择,可以由项目进行选择。
有关如何查找给定项目的虚拟环境以及如何安装、卸载和升级包的更多信息,请参阅PyCharm文档此处。
基本上,流程如下:
- 打开项目设置
- 选择Python解释器
- 单击+图标以添加新的Python包
英文:
PyCharm typically uses one of a selection of virtual environments, and this is selectable by project.
For more information on how to locate the virtual environment for a given project and how to Install, uninstall, and upgrade packages, see the PyCharm documentation here.
Essentially the process is:
- open project settings
- choose Python Interpreter
- click + icon to add a new Python package
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论