新建了一个conda环境"tf2",在该环境内想要使用pip命令下载第三方包,结果出现问题:
Script file 'D:\software\Anaconda3\envs\tf2\Scripts\pip-script.py' is not present.
在网上查找解决方案后,使用easy_install命令进行安装,安装过程中的打印内容如下:
(tf2) C:\Users\DESNY>easy_install pip
WARNING: The easy_install command is deprecated and will be removed in a future version.
Searching for pip
Best match: pip 20.2.4
Adding pip 20.2.4 to easy-install.pth file
Installing pip-script.py script to c:\users\desny\appdata\local\programs\python\python39\Scripts
Installing pip.exe script to c:\users\desny\appdata\local\programs\python\python39\Scripts
Installing pip3-script.py script to c:\users\desny\appdata\local\programs\python\python39\Scripts
Installing pip3.exe script to c:\users\desny\appdata\local\programs\python\python39\Scripts
Installing pip3.8-script.py script to c:\users\desny\appdata\local\programs\python\python39\Scripts
Installing pip3.8.exe script to c:\users\desny\appdata\local\programs\python\python39\Scripts
Using c:\users\desny\appdata\local\programs\python\python39\lib\site-packages
Processing dependencies for pip
Finished processing dependencies for pip
(tf2) C:\Users\DESNY>pip install gym
Script file 'D:\software\Anaconda3\envs\tf2\Scripts\pip-script.py' is not present.
虽然打印内容显示安装成功,但是再一次想要使用pip命令的时候依旧报之前的错误。
又仔细查看了一遍打印内容,发现pip相关文件都安装在用户文件夹下,而不是安装在conda环境的文件夹下,于是尝试将c:\users\desny\appdata\local\programs\python\python39\Scripts文件夹下的pip-script.py、pip.exe、pip3-script.py、pip3.exe、pip3.8-script.py、pip3.8.exe六个文件复制到D:\software\Anaconda3\envs\tf2\Scripts文件夹下。
再次使用pip命令就正常了。